DESKTOP-0GD05B0\Administrator 2 лет назад
Родитель
Сommit
3de5bb4a1f

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

@@ -205,3 +205,11 @@ export function doesTheTemplateExist(name) {
         params: {name}
     })
 }
+
+export function drugWithdrawal(data) {
+    return request({
+        url: url + '/drugWithdrawal',
+        method: 'post',
+        data: data
+    })
+}

+ 7 - 2
src/components/medical-insurance/patient-overview/Index.vue

@@ -13,7 +13,7 @@
     </el-select>
     <el-table
         :data="cptOverviews.slice((currentPage - 1) * 17, currentPage * 17)"
-        :height="visibleWindowSize.height - 100"
+        :height="visibleWindowSize.height - props.subtractHeight"
         highlight-current-row
         stripe
         @row-click="handleClickOverview"
@@ -69,6 +69,10 @@ export default {
       type: Boolean,
       default: false,
     },
+    subtractHeight: {
+      type: Number,
+      default: 100
+    }
   },
   emits: [],
   setup(props, ctx) {
@@ -166,7 +170,8 @@ export default {
       handleClickOverview,
       handleSelectionChange,
       handleMedTypeChange,
-      visibleWindowSize
+      visibleWindowSize,
+      props
     }
   },
 }

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

@@ -165,9 +165,12 @@ const sizeChange = (val) => {
   }
 }
 
-const clearSelection = () => {
+const clearSelection = (msg = true) => {
   tableRef.value.clearSelection()
-  ElMessage.success('清空成功。')
+  if (msg) {
+    ElMessage.success('清空成功。');
+  }
+
 }
 
 const contextmenu = (row, column, event) => {

+ 4 - 2
src/components/zhu-yuan-yi-sheng/shou-shu-shen-qing/DaYingShouShuShengQingDan.vue

@@ -170,13 +170,14 @@ const zuJianDaXiao = computed(() => {
   }
 })
 const zhiZhang = ref(2)
-const data = ref('')
+const data = ref({})
 const css = '*{font-size:16px}.tanXingHeZiHeng{display:flex;justify-content:space-between;margin-top:3pt;padding:0 3.75pt}.tanXingHeZiHeng2{display:flex;margin-top:3pt;padding:0 3.75pt}.tanXingHeZiShu{display:flex;flex-direction:column}.wen-zi{display:flex;margin-top:3pt;margin-left:5px;height:25px}.wen-zi div:first-child{display:flex;flex-direction:row;justify-content:center;text-align:right}.wen-zi div:nth-child(2){margin-left:3pt;display:table}.ge-zi{display:table-column}'
 
 const daYing = () => {
   if (!data) {
     return ElMessage.error('请先选择患者')
   }
+
   let LODOP = getLodop()
   const strFormHtml = '<style>' + css + '</style>' + '<body>' + document.getElementById('daYing').innerHTML + '</body>';
   LODOP.PRINT_INIT(0, 0, 522, 333, '检查申请') // 初始化打印机 名字
@@ -197,7 +198,8 @@ onMounted(() => {
 })
 
 defineExpose({
-  daYing
+  daYing,
+  data
 })
 
 </script>

+ 1 - 1
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/BaoCunXinXi.vue

@@ -49,7 +49,7 @@ import {onMounted, onUnmounted, Ref, ref, watch} from "vue";
 
 const props = defineProps({
   data: Object,
-  currentKey: String
+  currentKey: [String, Number]
 })
 
 const emit = defineEmits(['openOrCloseErrorMsg', 'clickError'])

+ 13 - 8
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/SouSuoYiZhu.vue

@@ -1,19 +1,20 @@
 <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>
+              @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-class-name="tableRowClassName">
-      <el-table-column label="编码" prop="code">
-        <template #default="scope">
-          <el-button @click="emit('xuanZhongFeiYong', scope.row)">{{ scope.row.orderCode }}</el-button>
-        </template>
-      </el-table-column>
+    <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>
@@ -31,7 +32,7 @@
         <template #default="scope">
           <el-button
               v-if="scope.row.serial !== '00'"
-              @click="queryDrugDetails(scope.row.orderCode.trim() + '_' + scope.row.serial.trim())">
+              @click.stop.prevent="queryDrugDetails(scope.row.orderCode.trim() + '_' + scope.row.serial.trim())">
             药品详情
           </el-button>
         </template>
@@ -136,6 +137,10 @@ const direction = (val) => {
   }
 }
 
+const selectedData = (row) => {
+  emit('xuanZhongFeiYong', row)
+}
+
 const enter = () => {
   if (dataIndex > -1) {
     emit('xuanZhongFeiYong', tempOrderData.value[dataIndex])

+ 5 - 0
src/utils/xckeydown.js

@@ -5,6 +5,7 @@ const direction = ['ArrowRight', 'ArrowLeft', 'ArrowDown', 'ArrowUp']
 let disabled = false
 
 export const xcHotKey = (keyList) => {
+    console.log('快捷键')
     enableShortcutKeys()
     registerShortcuts = keyList
     document.onkeydown = function (event) {
@@ -38,6 +39,7 @@ const shortcutTrigger = (event) => {
             let pressSimultaneously = listKey + 'Key'
             if (event[pressSimultaneously] && event.key === key) {
                 event.returnValue = false
+                event.preventDefault()
                 if (whetherToDisable()) return;
                 data[key]()
                 return
@@ -45,6 +47,7 @@ const shortcutTrigger = (event) => {
             if (key === 'direction') {
                 if ((event[pressSimultaneously] && direction.includes(event.code))) {
                     event.returnValue = false
+                    event.preventDefault()
                     if (whetherToDisable()) return;
                     data['direction'](event.key)
                     return
@@ -53,6 +56,7 @@ const shortcutTrigger = (event) => {
             if (key === 'number') {
                 if (event[pressSimultaneously] && event.code === ('Digit' + event.key)) {
                     event.returnValue = false
+                    event.preventDefault()
                     if (whetherToDisable()) return;
                     data['number'](event.key)
                     return
@@ -61,6 +65,7 @@ const shortcutTrigger = (event) => {
         }
         if (listKey === event.key) {
             event.returnValue = false
+            event.preventDefault()
             if (whetherToDisable()) return;
             registerShortcuts[listKey]()
             return

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

@@ -6,7 +6,7 @@
     </template>
 
     <template #aside="{size}">
-      <Overview v-show="xianShiLieBiao" :showSelection="false"/>
+      <Overview v-show="xianShiLieBiao" :showSelection="false" :subtract-height="200"/>
     </template>
 
     <template #main>

+ 197 - 223
src/views/hospitalization/zhu-yuan-yi-sheng/cao-yao-yi-zhu/XinZhengCaoYao.vue

@@ -141,9 +141,7 @@
                 circle
                 icon="Delete"
                 type="danger"
-                @click="
-                removeHerbs(scope.$index)
-              "
+                @click="removeHerbs(scope.$index)"
             >
             </el-button>
           </template>
@@ -165,7 +163,7 @@
   </el-dialog>
 </template>
 
-<script>
+<script setup name="XinZhenCaoYao">
 import router from '@/router'
 import {computed, onMounted, ref, watch} from 'vue'
 import {
@@ -182,253 +180,229 @@ import CaoYaoMuBan from '@/components/zhu-yuan-yi-sheng/cao-yao-yi-zhu/CaoYaoMuB
 import {yaoPinXiangMuPiPeiYiBao} from '@/api/public-api'
 import CuoWuXinXi from '@/components/zhu-yuan-yi-sheng/CuoWuXinXi.vue'
 
-export default {
-  name: 'XinZhenCaoYao',
-  components: {CuoWuXinXi, CaoYaoMuBan, ChaXuanCaoYao},
-  setup() {
-    const windowSize = computed(() => {
-      return store.state.app.windowSize
-    })
+const windowSize = computed(() => {
+  return store.state.app.windowSize
+})
 
-    /**
-     * 处方信息
-     */
-    const chuFang = ref({
-      orderName: '',
-      quantity: 0,
-      quantityDj: 0,
-      cyMtjs: 0,
-      cyJsl: 0,
-      cyZql: 0,
-      cyFj: 0,
-      cyFfcs: 0,
-      cyJssm: '',
-      groupNo: '81',
-    })
-    /**
-     * 编辑草药
-     * @type {Ref<UnwrapRef<{chargeCodeName: string, quantity: number, retprice: number, instruction: string, je: string, chargeCode: string}>>}
-     */
-    const caoYao = ref({
-      chargeCode: '',
-      chargeCodeName: '',
-      quantity: 0,
-      retprice: 0,
-      instruction: '',
-      je: '',
-    })
+/**
+ * 处方信息
+ */
+const chuFang = ref({
+  orderName: '',
+  quantity: 0,
+  quantityDj: 0,
+  cyMtjs: 0,
+  cyJsl: 0,
+  cyZql: 0,
+  cyFj: 0,
+  cyFfcs: 0,
+  cyJssm: '',
+  groupNo: '81',
+})
+/**
+ * 编辑草药
+ * @type {Ref<UnwrapRef<{chargeCodeName: string, quantity: number, retprice: number, instruction: string, je: string, chargeCode: string}>>}
+ */
+const caoYao = ref({
+  chargeCode: '',
+  chargeCodeName: '',
+  quantity: 0,
+  retprice: 0,
+  instruction: '',
+  je: '',
+})
 
-    /**
-     * 具体的草药明细
-     * @type {Ref<UnwrapRef<{weiYi: *[], list: *[]}>>}
-     */
-    const mingXi = ref({
-      weiYi: [],
-      list: [],
-    })
+/**
+ * 具体的草药明细
+ * @type {Ref<UnwrapRef<{weiYi: *[], list: *[]}>>}
+ */
+const mingXi = ref({
+  weiYi: [],
+  list: [],
+})
 
-    const chaXunCaoYaoZuJian = ref(false)
+const chaXunCaoYaoZuJian = ref(false)
 
-    /**
-     * 删除草药下标
-     * @param index
-     */
-    const removeHerbs = (index) => {
-      mingXi.weiYi.splice(index, 1);
-      mingXi.list.splice(index, 1)
-    }
+/**
+ * 删除草药下标
+ * @param index
+ */
+const removeHerbs = (index) => {
+  mingXi.value.weiYi.splice(index, 1);
+  mingXi.value.list.splice(index, 1)
+}
 
-    /**
-     * 查询草药信息中的 搜索框
-     * @type {null}
-     */
-    const queryName = ref(null)
-    /**
-     * 草药服用方法数据
-     * @type {Ref<UnwrapRef<*[]>>}
-     */
-    const fuYongFangFaShuJu = ref([])
+/**
+ * 查询草药信息中的 搜索框
+ * @type {null}
+ */
+const queryName = ref(null)
+/**
+ * 草药服用方法数据
+ * @type {Ref<UnwrapRef<*[]>>}
+ */
+const fuYongFangFaShuJu = ref([])
 
-    const dianJiXuanZhongCaoYao = (row) => {
-      let key = row.chargeCode + row.serial
-      if (mingXi.value.weiYi.indexOf(key) > -1) {
-        return ElMessage.error('请勿重复添加。')
-      } else {
-        ElMessage.success('添加成功。')
-        row.quantity = 1
-        row.je = row.retprice
-        mingXi.value.list.push(row)
-        mingXi.value.weiYi.push(key)
-      }
-    }
+const dianJiXuanZhongCaoYao = (row) => {
+  let key = row.chargeCode + row.serial
+  if (mingXi.value.weiYi.indexOf(key) > -1) {
+    return ElMessage.error('请勿重复添加。')
+  } else {
+    ElMessage.success('添加成功。')
+    row.quantity = 1
+    row.je = row.retprice
+    mingXi.value.list.push(row)
+    mingXi.value.weiYi.push(key)
+  }
+}
 
-    const dianJiBianJi = (row) => {
-      caoYao.value = row
-    }
+const dianJiBianJi = (row) => {
+  caoYao.value = row
+}
 
-    watch(
-        () => caoYao.value.quantity,
-        () => {
-          caoYao.value.je = (caoYao.value.quantity * caoYao.value.retprice).toFixed(2)
-        }
-    )
+watch(
+    () => caoYao.value.quantity,
+    () => {
+      caoYao.value.je = (caoYao.value.quantity * caoYao.value.retprice).toFixed(2)
+    }
+)
 
-    /**
-     * 下面是取模板的
-     */
-    const muBanZuJian = ref(false)
+/**
+ * 下面是取模板的
+ */
+const muBanZuJian = ref(false)
 
-    const dianJiXuanZhongMuBanShuJu = (data) => {
-      let flag = false
-      for (let item of data) {
-        if (item.groupNo !== chuFang.value.groupNo) {
-          ElMessage.error('模板药房和当前药房不相同')
-          return
-        }
-      }
-      data.forEach((item) => {
-        let key = item.chargeCode + item.serial
-        if (mingXi.value.weiYi.indexOf(key) > -1) {
-          flag = true
-        } else {
-          item.je = (item.quantity * item.retprice).toFixed(2)
-          item.groupName = item.groupNo === '81' ? '门诊中药房' : '颗粒剂药房'
-          mingXi.value.list.push(item)
-          mingXi.value.weiYi.push(key)
-        }
-      })
-      if (flag) {
-        ElMessage({
-          showClose: true,
-          message: '请勿重复添加。',
-          type: 'error',
-        })
-      }
+const dianJiXuanZhongMuBanShuJu = (data) => {
+  let flag = false
+  for (let item of data) {
+    if (item.groupNo !== chuFang.value.groupNo) {
+      ElMessage.error('模板药房和当前药房不相同')
+      return
     }
-
-    /**
-     * 下面是存模板
-     */
-    const cunMuBan = ref({
-      patternName: '',
-      dialog: false,
-      chongFuBiaoZhi: false,
-    })
-    const dianJiCunMuBan = () => {
-      let val = cunMuBan.value.patternName
-      if (stringIsBlank(val)) return
-      chongFuMuBanMing(val).then((res) => {
-        if (res) {
-          return ElMessage.error('模板名重复。')
-        } else {
-          let data = {
-            patternName: val,
-            list: mingXi.value.list,
-            deptCode: store.state.user.info.deptCode,
-          }
-          cunMuBanApi(data).then(() => {
-            cunMuBan.value.dialog = false
-            cunMuBan.value.patternName = ''
-          })
-        }
-      })
+  }
+  data.forEach((item) => {
+    let key = item.chargeCode + item.serial
+    if (mingXi.value.weiYi.indexOf(key) > -1) {
+      flag = true
+    } else {
+      item.je = (item.quantity * item.retprice).toFixed(2)
+      item.groupName = item.groupNo === '81' ? '门诊中药房' : '颗粒剂药房'
+      mingXi.value.list.push(item)
+      mingXi.value.weiYi.push(key)
     }
+  })
+  if (flag) {
+    ElMessage({
+      showClose: true,
+      message: '请勿重复添加。',
+      type: 'error',
+    })
+  }
+}
 
-    /**
-     * 保存草药
-     */
-    const dianJiBaoCunCaoYao = () => {
-      if (youWuXuanZheHuanZhe()) return
-      if (stringIsBlank(chuFang.value.orderName)) {
-        return ElMessage.error('请输入处方名。')
-      }
-      if (chuFang.value.quantity === 0) {
-        return ElMessage.error('请选择剂数')
-      }
-      if (chuFang.value.quantityDj === 0) {
-        return ElMessage.error('请选择代煎数')
+/**
+ * 下面是存模板
+ */
+const cunMuBan = ref({
+  patternName: '',
+  dialog: false,
+  chongFuBiaoZhi: false,
+})
+
+const dianJiCunMuBan = () => {
+  let val = cunMuBan.value.patternName
+  if (stringIsBlank(val)) return
+  chongFuMuBanMing(val).then((res) => {
+    if (res) {
+      return ElMessage.error('模板名重复。')
+    } else {
+      let data = {
+        patternName: val,
+        list: mingXi.value.list,
+        deptCode: store.state.user.info.deptCode,
       }
-      let listCode = []
-      mingXi.value.list.forEach((item) => {
-        listCode.push(item.chargeCode + '-' + item.serial)
-      })
-      yaoPinXiangMuPiPeiYiBao(listCode).then((res) => {
-        if (stringNotBlank(res)) {
-          cuoWuXinXi.value = res
-          ElMessageBox.confirm(res, '提示', {
-            type: 'warning',
-            dangerouslyUseHTMLString: true,
-          })
-              .then(() => {
-                baoCunShuJu()
-              })
-              .catch(() => {
-              })
-        } else {
-          baoCunShuJu()
-        }
+      cunMuBanApi(data).then(() => {
+        cunMuBan.value.dialog = false
+        cunMuBan.value.patternName = ''
       })
     }
+  })
+}
 
-    function baoCunShuJu() {
-      ElMessageBox.confirm(chuFang.value.quantity > 20 ? '剂数大于20是否继续录入?' : '请确定好数据?', '提示', {
+/**
+ * 保存草药
+ */
+const dianJiBaoCunCaoYao = () => {
+  if (youWuXuanZheHuanZhe()) return
+  if (stringIsBlank(chuFang.value.orderName)) {
+    return ElMessage.error('请输入处方名。')
+  }
+  if (chuFang.value.quantity === 0) {
+    return ElMessage.error('请选择剂数')
+  }
+  if (chuFang.value.quantityDj === 0) {
+    return ElMessage.error('请选择代煎数')
+  }
+  let listCode = []
+  mingXi.value.list.forEach((item) => {
+    listCode.push(item.chargeCode + '-' + item.serial)
+  })
+  yaoPinXiangMuPiPeiYiBao(listCode).then((res) => {
+    if (stringNotBlank(res)) {
+      cuoWuXinXi.value = res
+      ElMessageBox.confirm(res, '提示', {
         type: 'warning',
+        dangerouslyUseHTMLString: true,
       })
           .then(() => {
-            let data = chuFang.value
-            data.inpatientNo = huanZheXinXi.value.inpatientNo
-            data.admissTimes = huanZheXinXi.value.admissTimes
-            data.list = mingXi.value.list
-            data.deptCode = store.state.user.info.deptCode
-            baoCunCaoYao(data).then((res) => {
-              router.go(-1)
-            })
+            baoCunShuJu()
           })
           .catch(() => {
           })
+    } else {
+      baoCunShuJu()
     }
+  })
+}
 
-    const clearHerbalInformation = () => {
-      mingXi.weiYi = []
-      mingXi.list = []
-    }
-
-    onMounted(() => {
-      fuYongFangFa().then((res) => {
-        fuYongFangFaShuJu.value = res
+function baoCunShuJu() {
+  ElMessageBox.confirm(chuFang.value.quantity > 20 ? '剂数大于20是否继续录入?' : '请确定好数据?', '提示', {
+    type: 'warning',
+  })
+      .then(() => {
+        let data = chuFang.value
+        data.inpatientNo = huanZheXinXi.value.inpatientNo
+        data.admissTimes = huanZheXinXi.value.admissTimes
+        data.list = mingXi.value.list
+        data.deptCode = store.state.user.info.deptCode
+        baoCunCaoYao(data).then((res) => {
+          router.go(-1)
+        })
       })
-    })
+      .catch(() => {
+      })
+}
 
-    return {
-      router,
-      chuFang,
-      huanZheXinXi,
-      jiaShuiLeiXing: [
-        {code: '加凉水', name: '加凉水'},
-        {code: '加温水', name: '加温水'},
-        {code: '加开水', name: '加开水'},
-        {code: '加冰水', name: '加冰水'},
-        {code: '加外糖水', name: '加外糖水'},
-        {code: '外敷', name: '外敷'},
-      ],
-      fuYongFangFaShuJu,
-      mingXi,
-      windowSize,
-      dianJiXuanZhongCaoYao,
-      dianJiBianJi,
-      caoYao,
-      queryName,
-      dianJiCunMuBan,
-      cunMuBan,
-      dianJiBaoCunCaoYao,
-      chaXunCaoYaoZuJian,
-      muBanZuJian,
-      dianJiXuanZhongMuBanShuJu,
-      clearHerbalInformation,
-      removeHerbs
-    }
-  },
+const clearHerbalInformation = () => {
+  mingXi.value.weiYi = []
+  mingXi.value.list = []
 }
+
+onMounted(() => {
+  fuYongFangFa().then((res) => {
+    fuYongFangFaShuJu.value = res
+  })
+})
+
+let jiaShuiLeiXing = [
+  {code: '加凉水', name: '加凉水'},
+  {code: '加温水', name: '加温水'},
+  {code: '加开水', name: '加开水'},
+  {code: '加冰水', name: '加冰水'},
+  {code: '加外糖水', name: '加外糖水'},
+  {code: '外敷', name: '外敷'},
+]
+
 </script>
 
 <style scoped></style>

+ 5 - 6
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.js

@@ -5,14 +5,13 @@ import {baseinfo} from "@/data/inpatient";
 import {huoQuGeRenPinLv} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
 
 // 获取患者的频率数据
-export const huanZhePinLvData = ref([])
+export const huanZhePinLvData = ref([
+    {code: 0, name: '全部'},
+    {code: 1, name: '临时医嘱'},
+    {code: 2, name: '长期医嘱'}
+])
 // 患者信息
 export const huanZheXinXi = computed(() => {
-    if (stringNotBlank(baseinfo().inpatientNo)) {
-        huoQuGeRenPinLv(baseinfo().inpatientNo, baseinfo().admissTimes).then((res) => {
-            huanZhePinLvData.value = res
-        })
-    }
     return baseinfo()
 })
 // 是否点击了修改整个模板

+ 29 - 9
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/TianJiaYiZhu.vue

@@ -28,8 +28,13 @@
   {{ count }}
   <el-button @click="showErrorMessage = true">打开错误信息</el-button>
   <el-divider direction="vertical"/>
-  <el-button :disabled="yiZhuData.serial === '00' || stringIsBlank(yiZhuData.serial)" icon="View" type="success"
-             @click="HeLiYongYao.dialog = true"> 药品用法
+  <el-button :disabled="yiZhuData.serial === '00' || stringIsBlank(yiZhuData.serial)"
+             icon="View"
+             type="success"
+             @click="synopsis({
+             orderCode: yiZhuData.orderCode,
+             serial: yiZhuData.serial
+             })"> 药品用法
   </el-button>
   <el-divider direction="vertical"></el-divider>
   <el-button @click="tiaoZhuanZhiHeLiYongYao">合理用药</el-button>
@@ -786,6 +791,7 @@ const synopsis = (val) => {
 /* 保存信息 */
 const baoCunYiZhuClick = () => {
   disableShortcutKeys()
+  if (youWuXuanZheHuanZhe()) return
   if (listIsBlank(yiZhuList.value)) {
     return ElMessage.error('请先选择数据')
   }
@@ -794,12 +800,20 @@ const baoCunYiZhuClick = () => {
     admissTimes: huanZheXinXi.value.admissTimes,
     list: yiZhuList.value,
   }
-
-  saveTheDoctorSOrder(data).then((res) => {
-  }).finally(() => {
-    enableShortcutKeys()
+  ElMessageBox.confirm('是否确认医嘱?', '提示', {
+    confirmButtonText: '已确认',
+    cancelButtonText: '让我在想想'
+  }).then(() => {
+    saveTheDoctorSOrder(data).then((res) => {
+      ElMessage.success('医嘱确认成功')
+      router.go(-1)
+    }).finally(() => {
+      enableShortcutKeys()
+    })
+  }).catch(() => {
   })
 
+
 }
 
 /* 医嘱错误信息 */
@@ -955,7 +969,7 @@ onUnmounted(() => {
 
 // 倒计时功能
 const kaiQiDaoJiShi = () => {
-  seconds.value = 1600
+  seconds.value = 1800
   clearInterval(daoJiShi)
   daoJiShi = setInterval(() => {
     seconds.value--
@@ -1143,18 +1157,24 @@ const enterToJumpInput = async (val) => {
 
 /* 回车按下 跳转到下一个 input , 暂时未启用 end */
 
-onMounted(() => {
+onMounted(async () => {
   // huanZheXinXi.value.inpatientNo = '0409327'
   // huanZheXinXi.value.admissTimes = 1
   xcHotKey(shortcutKeyRegistration)
   yiZhuList.value = clone(fuZhiYiZhu.value)
+  let serverTime = await getServerDateApi();
   for (let i = 0; i < yiZhuList.value.length; i++) {
     yiZhuList.value[i].id = yiZhuList.value[i].actOrderNo
+    yiZhuList.value[i].orderTime = serverTime
+    yiZhuList.value[i].startTime = serverTime
+    yiZhuList.value[i].endTime = serverTime
+    yiZhuList.value[i].frequCodeName = '一次'
+    yiZhuList.value[i].frequCode = 'ONCE'
   }
   if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
     ElMessage.warning('您现在进入的是医嘱模板编辑')
   } else {
-    ElMessage.warning('您现在进入的是医嘱编辑模块,' + '您的编辑时间有 10 分钟,你准备好了吗?')
+    ElMessage.warning('您现在进入的是医嘱编辑模块,' + '您的编辑时间有 30 分钟,你准备好了吗?')
     kaiQiDaoJiShi()
     whetherThePatientHasAllergens(huanZheXinXi.value.inpatientNo).then((res) => {
       allergenDialog = res

+ 70 - 22
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/YiZhuLuRu.vue

@@ -55,7 +55,7 @@
     <el-button type="warning" :disabled="stringIsBlank(huanZheXinXi.inpatientNo)" @click="jumpToMedicalRecord"> 病案首页
     </el-button>
     <el-button type="primary" @click="openElectronicMedicalRecord"> 电子病历</el-button>
-
+    <el-button type="danger" @click="clickDrugReturn"> 退药</el-button>
     <xc-table :data="yiZhuPage"
               row-key="id"
               @currentChange="handleCurrentChange"
@@ -64,7 +64,7 @@
               @rowContextmenu="clickToViewTheDoctorSOrderFee"
               @selectionChange="huoQuXuanZhongDeShuJu"
               ref="tableRef">
-      <el-table-column fixed="left" type="selection"></el-table-column>
+      <el-table-column fixed="left" type="selection" :reserve-selection="true"></el-table-column>
       <el-table-column fixed="left" label="医嘱号" prop="actOrderNo"
                        width="120" show-overflow-tooltip>
         <template #default="scope">
@@ -77,7 +77,7 @@
       </el-table-column>
       <el-table-column fixed="left" width="20">
         <template #default="scope">
-          {{ scope.row.orderGroup }}
+          <span style="color: red">{{ scope.row.orderGroup }}</span>
         </template>
       </el-table-column>
       <el-table-column fixed="left" label="医嘱名称" show-overflow-tooltip width="135">
@@ -140,15 +140,21 @@
       </el-table-column>
     </xc-table>
 
-    <el-dialog v-model="yiZhuChaoZuoDialog" :close-on-click-modal="false" :close-on-press-escape="false"
-               :show-close="false" :title="yiZhuChaoZuoBiaoTi" top="25%" width="30%">
+    <el-dialog v-model="yiZhuChaoZuoDialog"
+               :close-on-click-modal="false" :close-on-press-escape="false"
+               :show-close="false"
+               :title="yiZhuChaoZuoBiaoTi"
+               top="25%" width="30%">
       <div v-if="chaoZuoBiaoZhi === 2">
         撤销原因:
         <el-input v-model="content" maxlength="100" rows="2" show-word-limit type="textarea"></el-input>
       </div>
       <div v-else-if="chaoZuoBiaoZhi === 3 || chaoZuoBiaoZhi === 90">
         停止时间点:
-        <el-date-picker v-model="tingZhiRiQi" format="YYYY-MM-DD HH:mm:ss" type="datetime"
+        <el-date-picker v-model="tingZhiRiQi"
+                        format="YYYY-MM-DD HH:mm:ss"
+                        type="datetime"
+                        :disabled-date="stopTimeLimit"
                         value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
       </div>
       <template #footer>
@@ -170,6 +176,7 @@
 <script name="YiZhuLuRuZhuJian" setup>
 import {shortcuts} from '@/data/shortcuts'
 import {
+  drugWithdrawal,
   expensesForGettingADoctorSOrder,
   huoQuYiZhuMingCheng,
   huoQuYiZhuShuJu,
@@ -186,6 +193,7 @@ import XcTable from "@/components/xiao-chan/xc-table/XcTable.vue";
 import sleep from "@/utils/sleep";
 import DoctorSOrderFee from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/DoctorSOrderFee.vue";
 import {BizException, ExceptionEnum} from "@/utils/BizException";
+import {ElMessage, ElMessageBox} from "element-plus";
 
 const windowSize = computed(() => {
   return store.state.app.windowSize
@@ -200,11 +208,11 @@ const dateRange = ref([])
 let orderName = $ref('')
 const yiZhuMingZiData = ref([])
 // 获取频率
-const pinLv = ref('')
+const pinLv = ref(1)
 // 表格
 let tableRef = $ref(null)
 // 状态
-const zhuangTai = ref(0)
+const zhuangTai = ref(3)
 // 医嘱号
 let actOrderNo = $ref('')
 // 分页
@@ -316,18 +324,32 @@ const openElectronicMedicalRecord = () => {
   window.open(routeData.href, '_blank');
 }
 
-const dianJiYiZhuChaoZuo = ({actOrderNo, orderName}, flag, name) => {
+/**
+ * 停止时间限制
+ * @param date
+ * @returns {boolean}
+ */
+const stopTimeLimit = (date) => {
+  return (date.getTime() - currentClickTime.getTime()) < 0
+}
+
+// 点击了停止医嘱的时间
+let currentClickTime = null
+
+const dianJiYiZhuChaoZuo = async ({actOrderNo, orderName}, flag, name) => {
   chaoZuoBiaoZhi = flag
   yiZhuHao.value = actOrderNo
   if (flag === 1) {
     zhiXingChaoZuo()
   } else {
-    yiZhuChaoZuoDialog = true
     if (flag === 2) {
       yiZhuChaoZuoBiaoTi = '撤销医嘱'
     } else if (flag === 3) {
       yiZhuChaoZuoBiaoTi = '停止医嘱'
+      tingZhiRiQi.value = await getServerDateApi()
+      currentClickTime = new Date(tingZhiRiQi.value)
     }
+    yiZhuChaoZuoDialog = true
   }
 }
 
@@ -377,21 +399,13 @@ const huoQuXuanZhongDeShuJu = (val) => {
   xuanZhongDeShuJu.value = val
 }
 
-// 用户切换全选和全不选 时 el-table中的全选不会选中子节点
-const toggleSelection = (row, selected) => {
-  if (row) {
-    row.forEach((item) => {
-      tableRef.value.toggleRowSelection(item, selected)
-    })
-  }
-}
-
-
 /**
  * 点击复制医嘱
  */
 const dianJiFuZhuXuanZhongYiZhu = () => {
   fuZhiYiZhu.value = xuanZhongDeShuJu.value
+  addYiZhuClick()
+  tableRef.clearSelection(false)
 }
 
 /**
@@ -476,10 +490,12 @@ function getYiZhuFlag(val) {
 /**
  * 点击批量停止
  */
-const clickBatchStop = () => {
-  yiZhuChaoZuoDialog = true
+const clickBatchStop = async () => {
+  tingZhiRiQi.value = await getServerDateApi()
+  currentClickTime = new Date(tingZhiRiQi.value)
   chaoZuoBiaoZhi = 90
   yiZhuChaoZuoBiaoTi = '批量停止'
+  yiZhuChaoZuoDialog = true
 }
 
 const dianJiDuiHuaKuangZhongDeGuanBi = () => {
@@ -506,6 +522,38 @@ const jumpToMedicalRecord = () => {
     },
   })
 }
+
+/**
+ * 点击医嘱退药
+ */
+const clickDrugReturn = () => {
+  console.log(xuanZhongDeShuJu.value)
+  if (xuanZhongDeShuJu.value.length === 0) {
+    return ElMessage.error('请先选中数据')
+  }
+  ElMessageBox.confirm('请确认是否要退这些药品,项目无法退费。', '提示', {
+    type: 'warning',
+    confirmButtonText: '已确认',
+    cancelButtonText: '让我在想想'
+  }).then(() => {
+    let temp = []
+    xuanZhongDeShuJu.value.forEach(item => {
+      if (item.serial !== '00' && item.drugFlag !== 'd' && item.orderCode !== '06054') {
+        temp.push(item.id)
+      }
+    })
+
+    drugWithdrawal(temp).then(() => {
+      tableRef.clearSelection(false)
+    })
+
+  }).catch(() => {
+
+  })
+
+}
+
+
 </script>
 
 <style scoped lang="scss">