소스 검색

医嘱页面优化以及新的出院带药

DESKTOP-0GD05B0\Administrator 2 년 전
부모
커밋
d4ef5fb83f

+ 230 - 0
src/components/xiao-chan/xc-el-table-v2/XcElTableV2.vue

@@ -0,0 +1,230 @@
+<template>
+    <el-table-v2 v-if="isShow"
+                 ref="tableRef"
+                 class="xc-el-table-v2"
+                 :cache="4"
+                 fixed
+                 :data="props.data"
+                 :columns="props.columns"
+                 :width="props.width"
+                 :height="props.height"
+                 :header-height="props.headerHeight"
+                 :row-event-handlers="rowEvent"
+                 :row-height="rowHeight"
+                 :row-class="props.rowClassName"/>
+</template>
+
+<script setup name="XcElTableV2">
+import {ElCheckbox} from "element-plus";
+
+const props = defineProps({
+    data: {
+        type: Array,
+        default: []
+    },
+    columns: {
+        type: Array,
+        default: []
+    },
+    width: {
+        type: Number,
+        default: 500
+    },
+    height: {
+        type: Number,
+        default: 500
+    },
+    rowClassName: {
+        type: Function,
+        default: null
+    },
+    headerHeight: {
+        type: Number,
+        default: 25
+    },
+    rowHeight: {
+        type: Number,
+        default: 24
+    },
+})
+
+
+const emits = defineEmits(['rowClick', 'rowContextmenu', 'rowDblclick'])
+
+let timer = null
+const rowEvent = {
+    'onClick': (val) => {
+        if (timer) {
+            clearTimeout(timer)
+        }
+        timer = setTimeout(() => {
+            emits('rowClick', val)
+        }, 200)
+    },
+    'onContextmenu': (val) => {
+        val.event.preventDefault();
+        emits('rowContextmenu', val)
+    },
+    'onDblclick': (val) => {
+        if (timer) {
+            clearTimeout(timer)
+        }
+        emits('rowDblclick', val)
+    }
+}
+
+const selectedData = ref({})
+const intermediate = ref(false)
+const selectedAll = ref(false)
+
+const isShow = ref(false)
+
+const tableRef = ref(null)
+
+/**
+ * 选中当前行
+ * @param val 是否选中
+ * @param row 行数据
+ * @param rowIndex 行下标
+ */
+const selectedRow = (val, row, rowIndex) => {
+    if (val) {
+        selectedData.value[rowIndex] = row
+    } else {
+        delete selectedData.value[rowIndex]
+    }
+    row.$selected = val
+    let length = Object.keys(selectedData.value).length
+    intermediate.value = length > 0
+    selectedAll.value = props.data.length === length
+    if (selectedAll.value) {
+        intermediate.value = false
+    }
+}
+
+/**
+ * 全选或者取消全选
+ * @param val 是否全选
+ * */
+const selectAllClick = (val) => {
+    for (let i = 0; i < props.data.length; i++) {
+        selectedRow(val, props.data[i], i)
+    }
+}
+
+const getSelected = () => {
+    let tempData = []
+    for (let key in selectedData.value) {
+        let item = selectedData.value[key]
+        tempData.push(item)
+    }
+    return tempData
+}
+
+const typeObj = [{
+    key: 'selected',
+    dataKey: 'selected',
+    width: 30,
+    cellRenderer: ({rowData, rowIndex}) => {
+        return h(ElCheckbox, {
+            modelValue: rowData.$selected,
+            onClick: (e) => {
+                e.stopImmediatePropagation();
+            },
+            onChange: (val) => {
+                selectedRow(val, rowData, rowIndex)
+            }
+        }, null)
+    },
+    headerCellRenderer: () => {
+        return h(ElCheckbox,
+            {
+                modelValue: selectedAll.value,
+                indeterminate: intermediate.value,
+                onChange: (e) => {
+                    selectAllClick(e)
+                }
+            },
+            null)
+    }
+}, {
+    key: 'index',
+    dataKey: 'index',
+    title: '排序',
+    width: 50,
+    cellRenderer: ({rowIndex}) => {
+        return h('span', {}, rowIndex)
+    }
+}]
+
+const scrollTo = (val) => {
+    tableRef.value.scrollTo(val)
+}
+
+const scrollToLeft = (scrollLeft) => {
+    tableRef.value.scrollToLeft(scrollLeft)
+}
+
+const scrollToTop = (scrollTop) => {
+    tableRef.value.scrollToTop(scrollTop)
+}
+
+const scrollToRow = (...val) => {
+    tableRef.value.scrollToRow(...val)
+}
+
+const clearSelected = () => {
+    selectAllClick(false)
+}
+
+defineExpose({
+    selectedRow,
+    getSelected,
+    clearSelected,
+    scrollTo,
+    scrollToLeft,
+    scrollToTop,
+    scrollToRow
+})
+
+onMounted(() => {
+    for (let i = 0; i < props.columns.length; i++) {
+        let item = props.columns[i]
+        if (item.type && item.type === 'selected') {
+            props.columns[i] = typeObj[0]
+            for (let columnKey in item) {
+                props.columns[i][columnKey] = item[columnKey]
+            }
+        }
+        if (item.type && item.type === 'index') {
+            props.columns[i] = typeObj[1]
+            for (let columnKey in item) {
+                props.columns[i][columnKey] = item[columnKey]
+            }
+        }
+        props.columns[i]['dataKey'] = item.key
+    }
+    isShow.value = true
+})
+
+</script>
+
+<style lang="scss">
+.xc-el-table-v2 {
+  .el-table-v2__header-cell {
+    font-size: 12px;
+    padding: 0 !important;
+  }
+
+  .el-table-v2__row-cell {
+    padding: 0 !important;
+    font-size: 12px;
+  }
+
+  //.el-table-v2__row {
+  //  &:hover {
+  //    background-color: transparent;
+  //  }
+  //}
+}
+</style>

+ 0 - 201
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/SouSuoYiZhu.vue

@@ -1,201 +0,0 @@
-<template>
-  <el-dialog v-model="dialog" title="搜索医嘱" width="95%" @close="emit('close')">
-    <el-input ref="searchInput" v-model="orderName" autofocus clearable style="width: 220px"
-              @keyup.enter="dianJiChaXunYiZhu"
-    ></el-input>
-    <el-button icon="Search" type="primary" @click="dianJiChaXunYiZhu">搜索</el-button>
-    <xc-code code="ctrl+1" description="重新获取焦点"/>
-    <xc-code code="Alt+↓/↑" description="上下选择"></xc-code>
-    <xc-code code="Alt+←/→" description="左右翻页"></xc-code>
-    <xc-code code="Alt+Enter" description="选中"></xc-code>
-    <xc-code code="Alt+Q" description="查看药品用法"></xc-code>
-    <el-table :data="tempOrderData"
-              :height="windowSize.h / 1.6"
-              ref="elTableRef"
-              @row-click="selectedData"
-              :row-class-name="tableRowClassName">
-      <el-table-column label="编码" prop="orderCode"></el-table-column>
-      <el-table-column label="名称" prop="orderName"></el-table-column>
-      <el-table-column label="规格" prop="drugSpecification"></el-table-column>
-      <el-table-column label="描述" prop="discription"></el-table-column>
-      <el-table-column label="库存" prop="stockAmount"></el-table-column>
-      <el-table-column label="大包装" prop="specPack"></el-table-column>
-      <el-table-column label="医保类型" prop="ybFlagNew"></el-table-column>
-      <el-table-column label="医保编码" prop="nationalCode"></el-table-column>
-      <el-table-column label="医保名称" prop="nationalName"></el-table-column>
-      <el-table-column label="医保备注" prop="ybComment"></el-table-column>
-      <el-table-column label="大输液" prop="infusionFlagName"></el-table-column>
-      <el-table-column label="厂家" prop="manuName"></el-table-column>
-      <el-table-column label="类型" prop="orderType"></el-table-column>
-      <el-table-column label="毒麻类型" prop="drugFlagName"></el-table-column>
-      <el-table-column label="药品详情">
-        <template #default="scope">
-          <el-button
-              v-if="scope.row.serial !== '00'"
-              @click.stop.prevent="queryDrugDetails(scope.row.orderCode.trim() + '_' + scope.row.serial.trim())">
-            药品详情
-          </el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <el-pagination
-        :current-page="orderData.currentPage"
-        :page-size="orderData.pageSize"
-        :total="orderData.data.length"
-        layout="total,prev,pager,next,jumper"
-        @current-change="orderDataCurrent"
-        ref="pageRef"
-    >
-    </el-pagination>
-    <yao-ping-xiang-qing v-if="yaoPinXiangQing.dialog" :code="yaoPinXiangQing.code"
-                         @close="yaoPinXiangQing.dialog = false"></yao-ping-xiang-qing>
-  </el-dialog>
-</template>
-
-<script name="SouSuoYiZhu" setup>
-import {huoQuXiangMu} from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
-import {computed, ref} from 'vue'
-import store from '@/store'
-import YaoPingXiangQing from '@/components/zhu-yuan-yi-sheng/he-li-yong-yao/YaoPingXiangQing.vue'
-import {xcHotKey} from '@/utils/xckeydown'
-import {ElMessage} from 'element-plus'
-import Sleep from '@/utils/sleep'
-import {setScrollTop} from "@/utils/el-table-scroll";
-import XcCode from "@/components/xiao-chan/code/XcCode.vue";
-
-const emit = defineEmits(['xuanZhongFeiYong', 'close'])
-
-const windowSize = computed(() => {
-  return store.state.app.windowSize
-})
-let dialog = $ref(true)
-const orderName = ref('') // 01672
-let searchInput = $ref(null)
-let dataIndex = $ref(-1)
-let elTableRef = $ref(null)
-let count = computed(() => {
-  return Math.ceil(orderData.value.data.length / orderData.value.pageSize)
-})
-
-const orderData = ref({
-  currentPage: 1,
-  pageSize: 10,
-  data: [],
-})
-
-const tempOrderData = computed(() => {
-  return orderData.value.data.slice((orderData.value.currentPage - 1) * orderData.value.pageSize, orderData.value.currentPage * orderData.value.pageSize)
-})
-
-const dianJiChaXunYiZhu = () => {
-  huoQuXiangMu(orderName.value).then(async (res) => {
-    orderData.value.data = res
-    orderData.value.currentPage = 1
-    dataIndex = -1
-  })
-}
-
-const queryDrugDetails = (code) => {
-  yaoPinXiangQing.dialog = true;
-  yaoPinXiangQing.code = code
-}
-
-const orderDataCurrent = (val) => {
-  dataIndex = 0
-  orderData.value.currentPage = val
-}
-
-const tableRowClassName = ({row, rowIndex}) => {
-  if (dataIndex === rowIndex) {
-    return 'input_and_table_to_be_selected'
-  }
-}
-
-let yaoPinXiangQing = $ref({
-  dialog: false,
-  code: '',
-})
-
-const direction = (val) => {
-  let pageDataLength = tempOrderData.value.length
-  if (pageDataLength > 0) {
-    removeHoverStyle()
-    switch (val) {
-      case 'ArrowUp':
-        dataIndex <= 0 ? (dataIndex = pageDataLength - 1) : dataIndex--
-        break
-      case 'ArrowDown':
-        dataIndex === pageDataLength - 1 ? (dataIndex = 0) : dataIndex++
-        break
-      case 'ArrowRight':
-        orderDataCurrent(orderData.value.currentPage + 1 > count.value ? 1 : orderData.value.currentPage + 1)
-        break
-      case 'ArrowLeft':
-        orderDataCurrent(orderData.value.currentPage - 1 < 1 ? count.value : orderData.value.currentPage - 1)
-        break
-    }
-    setScrollTop(elTableRef, dataIndex)
-  }
-}
-
-const selectedData = (row) => {
-  emit('xuanZhongFeiYong', row)
-}
-
-const enter = () => {
-  if (dataIndex > -1) {
-    emit('xuanZhongFeiYong', tempOrderData.value[dataIndex])
-  } else {
-    ElMessage.error('请先选择数据')
-  }
-}
-
-const viewDrugUsage = () => {
-  if (dataIndex > -1) {
-    let data = tempOrderData.value[dataIndex]
-    if (data.serial !== '00') {
-      yaoPinXiangQing.dialog = true
-      yaoPinXiangQing.code = data.orderCode.trim() + '_' + data.serial.trim()
-    } else {
-      ElMessage.error('这个是项目')
-    }
-  } else {
-    ElMessage.error('请先选择数据')
-  }
-}
-
-const regainFocus = () => {
-  searchInput.focus()
-}
-
-let registerShortcuts = {
-  alt: {direction: direction, Enter: enter, q: viewDrugUsage},
-  ctrl: {1: regainFocus},
-}
-
-const hotKey = () => {
-  xcHotKey(registerShortcuts)
-}
-
-onMounted(async () => {
-  await Sleep(500)
-  if (searchInput) {
-    searchInput.focus()
-  }
-  hotKey()
-})
-
-const removeHoverStyle = () => {
-  let oldItem = elTableRef.$el.classList
-  let newItem = []
-  for (let i = 0; i < oldItem.length; i++) {
-    if (oldItem[i] !== 'el-table--enable-row-hover') {
-      newItem.push(oldItem[i])
-    }
-  }
-  elTableRef.$el.classList = newItem
-  elTableRef.$el.className = newItem.join(' ')
-}
-</script>
-
-<style scoped></style>

+ 175 - 172
src/views/hospitalization/case-front-sheet/JieShouHuiZhen.vue

@@ -1,66 +1,69 @@
 <template>
-  <page-layer>
-    <template #header>
-      <el-date-picker v-model="dateRange"
-                      :shortcuts="shortcuts"
-                      style="width: 220px"
-                      end-placeholder="结束日期"
-                      range-separator="至"
-                      start-placeholder="开始日期"
-                      type="daterange"/>
-      <el-checkbox v-model="history" label="历史" @change="historyFunc"/>
-      <el-button icon="Search" type="primary" @click="getHuiZhenDataClick">检索</el-button>
-      <el-button icon="Upload" type="primary" @click="baoCunHuiZhenClick" v-if="!history">保存</el-button>
-      <el-button icon="Printer" type="success" @click="daYingClick">打印</el-button>
-      <el-button icon="View" type="info" @click="dianJiChaKanHuanZheJianYan">查看患者检验</el-button>
-      <el-button type="primary" @click="enterMedicalOrder" v-if="!history">医嘱录入</el-button>
-      <el-tag type="danger">会诊意见限制 1100 个字</el-tag>
-    </template>
-    <template #main>
-      <pat-infomation-dialog
-          v-if="dialog"
-          @closed="dialog = false"
-          :pat-no="rowData.inpatientNo"
-          :admiss-date="rowData.admissDate"
-          :times="rowData.admissTimes"
-          :leave-hospital="1"
-          :dics="dics"/>
-      <el-container>
-        <el-aside width="500px">
-          <xc-table :local-data="huanZeData" :final-height="windowSize.h / 1.1" @row-click="dianJiDanYuanGe">
-            <el-table-column label="床号" prop="bedNo" width="40px"></el-table-column>
-            <el-table-column label="住院号_次数" prop="inpatientNo">
-              <template #default="scope"> {{ scope.row.inpatientNo }}_{{ scope.row.admissTimes }}</template>
-            </el-table-column>
-            <el-table-column label="姓名_申请次数" prop="name">
-              <template #default="scope"> {{ scope.row.name }}_{{ scope.row.reqTimes }}</template>
-            </el-table-column>
-            <el-table-column label="患者科室" prop="deptCodeName">
-              <template #default="scope">
-                {{ scope.row.deptCodeName }}
-              </template>
-            </el-table-column>
-            <el-table-column label="会诊科室" prop="reqDept1Name"></el-table-column>
-            <el-table-column label="会诊级别" prop="hzType">
-              <template #default="scope">
-                {{ hzJiBie(scope.row.hzType) }}
-              </template>
-            </el-table-column>
-            <el-table-column fixed="left" label="信息">
-              <template #default="{row}">
-                <el-button @click.stop="information(row)">信息</el-button>
-              </template>
-            </el-table-column>
-          </xc-table>
-        </el-aside>
-        <el-main>
-          <div style="overflow: auto;" :style="{height: windowSize.h - 30 + 'px'}">
-            <print-the-consultation-form ref="daYingHuiZhenRef"/>
-          </div>
-        </el-main>
-      </el-container>
-    </template>
-  </page-layer>
+    <page-layer>
+        <template #header>
+            <el-date-picker v-model="dateRange"
+                            :shortcuts="shortcuts"
+                            style="width: 220px"
+                            end-placeholder="结束日期"
+                            range-separator="至"
+                            start-placeholder="开始日期"
+                            type="daterange"/>
+            <el-checkbox v-model="history" label="历史" @change="historyFunc"/>
+            <el-button icon="Search" type="primary" @click="getHuiZhenDataClick">检索</el-button>
+            <el-button icon="Upload" type="primary" @click="baoCunHuiZhenClick" v-if="!history">保存</el-button>
+            <el-button icon="Printer" type="success" @click="daYingClick">打印</el-button>
+            <el-button icon="View" type="info" @click="dianJiChaKanHuanZheJianYan">查看患者检验</el-button>
+            <el-button type="primary" @click="enterMedicalOrder" v-if="!history">医嘱录入</el-button>
+            <el-tag type="danger">会诊意见限制 1100 个字</el-tag>
+        </template>
+        <template #main>
+            <pat-infomation-dialog
+                    v-if="dialog"
+                    @closed="dialog = false"
+                    :pat-no="rowData.inpatientNo"
+                    :admiss-date="rowData.admissDate"
+                    :times="rowData.admissTimes"
+                    :leave-hospital="1"
+                    :dics="dics"/>
+            <el-container>
+                <el-aside width="500px">
+                    <xc-table :local-data="huanZeData" :final-height="windowSize.h / 1.1" @row-click="dianJiDanYuanGe">
+                        <el-table-column label="床号" prop="bedNo" width="40px"></el-table-column>
+                        <el-table-column label="住院号_次数" prop="inpatientNo">
+                            <template #default="scope"> {{ scope.row.inpatientNo }}_{{
+                                scope.row.admissTimes
+                                }}
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="姓名_申请次数" prop="name">
+                            <template #default="scope"> {{ scope.row.name }}_{{ scope.row.reqTimes }}</template>
+                        </el-table-column>
+                        <el-table-column label="患者科室" prop="deptCodeName">
+                            <template #default="scope">
+                                {{ scope.row.deptCodeName }}
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="会诊科室" prop="reqDept1Name"></el-table-column>
+                        <el-table-column label="会诊级别" prop="hzType">
+                            <template #default="scope">
+                                {{ hzJiBie(scope.row.hzType) }}
+                            </template>
+                        </el-table-column>
+                        <el-table-column fixed="left" label="信息">
+                            <template #default="{row}">
+                                <el-button @click.stop="information(row)">信息</el-button>
+                            </template>
+                        </el-table-column>
+                    </xc-table>
+                </el-aside>
+                <el-main>
+                    <div style="overflow: auto;" :style="{height: windowSize.h - 30 + 'px'}">
+                        <print-the-consultation-form ref="daYingHuiZhenRef"/>
+                    </div>
+                </el-main>
+            </el-container>
+        </template>
+    </page-layer>
 </template>
 
 <script setup>
@@ -84,7 +87,7 @@ import {autopsies, haveOrNot, yesOrNo} from "@/views/hospitalization/case-front-
 ////////////////////////////// 获取屏幕高度 /////////////////////////////////////////
 
 const windowSize = computed(() => {
-  return store.state.app.windowSize
+    return store.state.app.windowSize
 })
 
 const daYingHuiZhenRef = ref(null)
@@ -96,26 +99,26 @@ const huanZeData = ref([])
 const history = ref(false)
 
 const getHuiZhenDataClick = () => {
-  let {startTime, endTime} = getDateRangeFormatDate(dateRange.value)
-  getHuiZhenData(startTime, endTime, history.value).then((res) => {
-    huanZeData.value = res
-  })
+    let {startTime, endTime} = getDateRangeFormatDate(dateRange.value)
+    getHuiZhenData(startTime, endTime, history.value).then((res) => {
+        huanZeData.value = res
+    })
 }
 
 const historyFunc = () => {
-  huanZeData.value = []
-  huanZheXinXi.value = {}
-  daYingHuiZhenRef.value.huiZhenXinXiXiangQing({})
+    huanZeData.value = []
+    huanZheXinXi.value = {}
+    daYingHuiZhenRef.value.huiZhenXinXiXiangQing({})
 }
 
 //////////////////////////////////////////// 点击右边的表格 ///////////////////////////////////////////////////////////
 const huanZheXinXi = ref({})
 
 const dianJiDanYuanGe = (val) => {
-  getHuanZheXinXi(val.admissTimes, val.reqTimes, val.inpatientNo).then((res) => {
-    huanZheXinXi.value = res
-    daYingHuiZhenRef.value.huiZhenXinXiXiangQing(res)
-  })
+    getHuanZheXinXi(val.admissTimes, val.reqTimes, val.inpatientNo).then((res) => {
+        huanZheXinXi.value = res
+        daYingHuiZhenRef.value.huiZhenXinXiXiangQing(res)
+    })
 }
 
 /**
@@ -123,130 +126,130 @@ const dianJiDanYuanGe = (val) => {
  * 要判断 一下 是仅保存 还是 完成会诊
  */
 const baoCunHuiZhenClick = () => {
-  if (!huanZheXinXi.value.name) {
-    ElMessage({
-      message: '请先选择患者',
-      showClose: true,
-      type: 'error',
-    })
-    return
-  }
-  if (stringIsBlank(huanZheXinXi.value.hzComment)) {
-    return ElMessage({
-      message: '请填写会诊意见',
-      showClose: true,
-      type: 'error',
+    if (!huanZheXinXi.value.name) {
+        ElMessage({
+            message: '请先选择患者',
+            showClose: true,
+            type: 'error',
+        })
+        return
+    }
+    if (stringIsBlank(huanZheXinXi.value.hzComment)) {
+        return ElMessage({
+            message: '请填写会诊意见',
+            showClose: true,
+            type: 'error',
+        })
+    }
+    ElMessageBox.confirm('是否保存【' + huanZheXinXi.value.name + '】的会诊信息', '提示', {
+        type: 'warning',
+        distinguishCancelAndClose: true,
+        cancelButtonText: '仅保存',
+        confirmButtonText: '完成会诊',
     })
-  }
-  ElMessageBox.confirm('是否保存【' + huanZheXinXi.value.name + '】的会诊信息', '提示', {
-    type: 'warning',
-    distinguishCancelAndClose: true,
-    cancelButtonText: '仅保存',
-    confirmButtonText: '完成会诊',
-  })
-      .then(async () => {
-        huanZheXinXi.value.statusFlag = 2
-        // 完成 会诊 发送 axios
-        await wanChenHuiZhen(huanZheXinXi.value)
-        await getHuiZhenDataClick()
-        huanZheXinXi.value = {}
-        daYingHuiZhenRef.value.huanZheXinXi.value = {}
-      })
-      .catch((e) => {
-        if (e === 'cancel') {
-          huanZheXinXi.value.statusFlag = 1
-          wanChenHuiZhen(huanZheXinXi.value)
-        }
-      })
+        .then(async () => {
+            huanZheXinXi.value.statusFlag = 2
+            // 完成 会诊 发送 axios
+            await wanChenHuiZhen(huanZheXinXi.value)
+            await getHuiZhenDataClick()
+            huanZheXinXi.value = {}
+            daYingHuiZhenRef.value.huanZheXinXi.value = {}
+        })
+        .catch((e) => {
+            if (e === 'cancel') {
+                huanZheXinXi.value.statusFlag = 1
+                wanChenHuiZhen(huanZheXinXi.value)
+            }
+        })
 }
 
 ///////////////////////////////////////////////////////// 开启打印 ///////////////////////////////////////////////////////////////////////////////
 const daYingClick = () => {
-  if (!huanZheXinXi.value.inpatientNo) {
-    ElMessage.error({
-      message: '请先选择患者',
-      showClose: true,
-    })
-    return
-  }
-  daYingHuiZhenRef.value.daYing()
+    if (!huanZheXinXi.value.inpatientNo) {
+        ElMessage.error({
+            message: '请先选择患者',
+            showClose: true,
+        })
+        return
+    }
+    daYingHuiZhenRef.value.printClick()
 }
 
 ///////////////////////////// 查看患者检验
 const dianJiChaKanHuanZheJianYan = () => {
-  if (!huanZheXinXi.value.inpatientNo) {
-    return ElMessage({
-      message: '请先选择患者',
-      showClose: true,
-      type: 'error',
-    })
-  } else {
-    let end = ''
-    getServerDateApi().then((res) => {
-      end = getFormatDatetime(res, 'YYYY-MM-DD')
-      router.push({
-        name: 'inspectionReportIndex',
-        params: {
-          passRule: true,
-          patNo: huanZheXinXi.value.inpatientNo,
-          start: huanZheXinXi.value.admissDate,
-          end: end,
-        },
-      })
-    })
-  }
+    if (!huanZheXinXi.value.inpatientNo) {
+        return ElMessage({
+            message: '请先选择患者',
+            showClose: true,
+            type: 'error',
+        })
+    } else {
+        let end = ''
+        getServerDateApi().then((res) => {
+            end = getFormatDatetime(res, 'YYYY-MM-DD')
+            router.push({
+                name: 'inspectionReportIndex',
+                params: {
+                    passRule: true,
+                    patNo: huanZheXinXi.value.inpatientNo,
+                    start: huanZheXinXi.value.admissDate,
+                    end: end,
+                },
+            })
+        })
+    }
 }
 
 // 跳转到医嘱录入页面
 const enterMedicalOrder = () => {
-  if (!huanZheXinXi.value.inpatientNo) {
-    return ElMessage({
-      message: '请先选择患者',
-      showClose: true,
-      type: 'error',
-    })
-  } else {
-    router.push({
-      name: 'yiZhuLuRu',
-      params: {
-        inpatientNo: huanZheXinXi.value.inpatientNo,
-        admissTimes: huanZheXinXi.value.admissTimes
-      }
-    })
-  }
+    if (!huanZheXinXi.value.inpatientNo) {
+        return ElMessage({
+            message: '请先选择患者',
+            showClose: true,
+            type: 'error',
+        })
+    } else {
+        router.push({
+            name: 'yiZhuLuRu',
+            params: {
+                inpatientNo: huanZheXinXi.value.inpatientNo,
+                admissTimes: huanZheXinXi.value.admissTimes
+            }
+        })
+    }
 }
 
 const rowData = ref({})
 const dialog = ref(false)
 const dics = ref({})
 const information = (row) => {
-  rowData.value = row
-  dialog.value = true
+    rowData.value = row
+    dialog.value = true
 }
 
 onMounted(() => {
-  dateRange.value[0] = shortcuts[0].value[0]
-  dateRange.value[1] = shortcuts[0].value[1]
-  getHuiZhenDataClick()
-  getAllDictionary().then(res => {
-    res.getOperations = operations;
-    res.getYesOrNo = yesOrNo;
-    res.getHaveOrNot = haveOrNot;
-    res.getAutopsies = autopsies;
-    dics.value = res
-  })
+    dateRange.value[0] = shortcuts[0].value[0]
+    dateRange.value[1] = shortcuts[0].value[1]
+    getHuiZhenDataClick()
+    getAllDictionary().then(res => {
+        res.getOperations = operations;
+        res.getYesOrNo = yesOrNo;
+        res.getHaveOrNot = haveOrNot;
+        res.getAutopsies = autopsies;
+        dics.value = res
+    })
 })
 
 // 会诊级别
 function hzJiBie(val) {
-  switch (val) {
-    case '1':
-      return '主治医师'
-    case '2':
-      return '副主任医生'
-    case '3':
-      return '主任医生'
-  }
+    switch (val) {
+        case '1':
+            return '主治医师'
+        case '2':
+            return '副主任医生'
+        case '3':
+            return '主任医生'
+    }
 }
 </script>
 

+ 21 - 2
src/views/hospitalization/zhu-yuan-yi-sheng/Home.vue

@@ -41,6 +41,8 @@ import {getJyJcZdTree} from "@/api/zhu-yuan-yi-sheng/jian-yan-jian-cha-shen-qing
 import EmrControlRule from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/emrControlRule.vue";
 import YzTag from "@/components/zhu-yuan-yi-sheng/YzTag.vue";
 import {useElementSize} from "@vueuse/core";
+import router from "@/router";
+import {shortcutTrigger, xcEvent} from "@/utils/xckeydown";
 
 const windowSize = computed(() => {
     return store.state.app.windowSize
@@ -49,12 +51,29 @@ const windowSize = computed(() => {
 const yzHeader = ref(null)
 const {height: yzHeaderHeight} = useElementSize(yzHeader)
 
+let keyWatch = null
+let shortcutKeyRegistration = {
+    'F2': () => {
+        router.push('/')
+    }
+}
+
+onDeactivated(() => {
+    if (keyWatch != null){
+        keyWatch()
+    }
+})
+
+onActivated(() => {
+    keyWatch = watch(() => xcEvent.value, () => {
+        shortcutTrigger(xcEvent.value, shortcutKeyRegistration)
+    })
+})
+
 watch(() => yzHeaderHeight.value, () => {
     yzHeaderSize.value = yzHeaderHeight.value
 }, {immediate: true})
 
-
-const mainRef = ref()
 onMounted(async () => {
     await nextTick()
     getJyJcZdTree().then((res) => {

+ 14 - 28
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/YiZhuLuRu.vue

@@ -1,10 +1,7 @@
 <template>
     <div style="margin: 0;height: 100%">
         <yz-query-condition :patient-info="huanZheXinXi"
-                            ref="yzQueryRef"
-                            @clearSelect="clearSelect"
                             @batchDeleteOrdersClick="batchDeleteOrdersClick"
-                            :to-delete-an-order="toDeleteAnOrder"
                             :add-yi-zhu-click="addYiZhuClick"
                             :click-on-the-order-template="clickOnTheOrderTemplate"
                             :confirm-orders-click="confirmOrdersClick"/>
@@ -94,7 +91,7 @@ import {
     clickOnThePatient,
     drugManual,
     associateOrders,
-    clearAssociate, youWuXuanZheHuanZhe, yzData, errorMsg
+    clearAssociate, youWuXuanZheHuanZhe, yzData, errorMsg, yzMitt
 } from '../public-js/zhu-yuan-yi-sheng'
 import store from '@/store'
 import {listIsBlank, stringIsBlank, stringNotBlank} from '@/utils/blank-utils'
@@ -136,8 +133,6 @@ let allergen = $ref({
     }
 })
 
-// 医嘱查询
-const yzQueryRef = ref(null)
 // 医嘱进度
 const orderProgressRef = ref(null)
 
@@ -150,7 +145,7 @@ const successfullyEntered = async (data) => {
         patNo: huanZheXinXi.value.inpatientNo,
         times: huanZheXinXi.value.admissTimes
     })
-    clearSelect()
+    yzMitt.emit('clearSelected')
     if (data != null) {
         tableRef.value.scrollTo(data.actOrderNo.toString())
     }
@@ -181,14 +176,7 @@ const confirmOrder = async () => {
     // 确认医嘱
     await yzEditorRef.value.confirmOrdersClick()
     // 查询医嘱
-    await yzQueryRef.value.queryYz();
-}
-
-/**
- * 删除医嘱
- */
-const toDeleteAnOrder = () => {
-    yzEditorRef.value.toDeleteAnOrderClick()
+    await yzMitt.emit('queryYz');
 }
 
 const openRationalDrugUse = () => {
@@ -252,7 +240,7 @@ const clickToStopTheOrder = () => {
             }
         } else {
             stopOrderDialog.value.error = {}
-            yzQueryRef.value.queryYz()
+            yzMitt.emit('queryYz')
         }
     })
 }
@@ -278,7 +266,7 @@ const voidOrdersClick = (val) => {
         closeOnClickModal: false
     }).then(({value}) => {
         voidOrders(val.id, value).then(res => {
-            yzQueryRef.value.queryYz()
+            yzMitt.emit('queryYz')
         })
     }).catch(() => {
 
@@ -329,6 +317,8 @@ const muBanShuJu = (val) => {
         val = val.filter((item) => {
             item.selfBuy = '4'
             item.instruction = item.frequCodeName
+            item.supplyCode = '007'
+            item.frequCode = 'ONCE'
             return item.serial !== '00'
         })
         if (val.length === 0) {
@@ -438,7 +428,7 @@ const clickAssociate = async (data) => {
         xcMessage.error('项目无法关联。');
     } else {
         if (associateOrders.value.actOrderNo === null) {
-            await yzQueryRef.value.queryYz()
+            await yzMitt.emit('queryYz')
             associateOrders.value.actOrderNo = data.actOrderNo
         } else {
             xcMessage.error('请先确认当前关联医嘱。')
@@ -459,19 +449,15 @@ const confirmAssociationClick = () => {
     }).then(() => {
         associateOrdersApi(associateOrders.value).then((res) => {
             clearAssociate()
-            yzQueryRef.value.queryYz()
+            yzMitt.emit('queryYz')
         })
     }).catch(() => {
     })
 }
 
 const duplicateAndPaste = async () => {
-    await yzQueryRef.value.queryYz()
-    tableRef.value.scrollToTheEnd()
-}
-
-const clearSelect = () => {
-    tableRef.value.clearSelected()
+    await yzMitt.emit('queryYz')
+    yzMitt.emit('tableScroll', tempYzData.value.length)
 }
 
 /**
@@ -507,7 +493,7 @@ const batchDeleteOrdersClick = () => {
                 errorMsg.value.type = 2
                 errorMsg.value.data = errData
             } else {
-                yzQueryRef.value.queryYz()
+                yzMitt.emit('queryYz', false)
             }
         })
     }).catch(() => {
@@ -525,8 +511,8 @@ watch(() => router.currentRoute.value, () => {
 onActivated(async () => {
     if (router.currentRoute.value.params.inpatientNo) {
         await nextTick()
-        clickOnThePatient(router.currentRoute.value.params.inpatientNo);
-        await yzQueryRef.value.queryYz()
+        await clickOnThePatient(router.currentRoute.value.params.inpatientNo);
+        await yzMitt.emit('queryYz')
     }
 })