Browse Source

住院医生的医嘱录入优化

DESKTOP-0GD05B0\Administrator 2 years ago
parent
commit
a41ef77d5c

+ 11 - 8
src/App.vue

@@ -37,13 +37,12 @@ export default defineComponent({
         store.commit('user/tokenChange', data.token)
       })
 
-
-      setCallback('sidSingle', async () => {
-        await store.dispatch('user/loginOut')
-        await ElMessageBox.alert('您的账号已在其他地方登陆,如需修改密码请在个人中心中修改。', '提示', {
-          type: 'warning',
-        })
-      })
+      // setCallback('sidSingle', async () => {
+      //   await store.dispatch('user/loginOut')
+      //   await ElMessageBox.alert('您的账号已在其他地方登陆,如需修改密码请在个人中心中修改。', '提示', {
+      //     type: 'warning',
+      //   })
+      // })
 
       setCallback('systemNotification', async (data) => {
         if (data.count) {
@@ -85,17 +84,21 @@ function getWindowSize() {
 
 ::-webkit-scrollbar {
   width: 6px;
+
   &:hover {
     cursor: pointer;
   }
 }
+
 ::-webkit-scrollbar-thumb {
   border-radius: 4px;
-  background: rgba(144,147,153,.3);
+  background: rgba(144, 147, 153, .3);
+
   &:hover {
     cursor: pointer;
   }
 }
+
 ::-webkit-scrollbar-button {
   width: 0;
   height: 0;

+ 1 - 1
src/components/index.ts

@@ -1,6 +1,6 @@
 export {default as XcSelect} from '../components/xiao-chan/select/XcSelect.vue'
 export {default as XcOption} from '../components/xiao-chan/select/XcOption.vue'
 export {default as XcCode} from '../components/xiao-chan/code/XcCode.vue'
-export {default as InputAndTable} from '../components/input-table-query/InputAndTable.vue'
+
 export {default as XcSelectV2} from '../components/xiao-chan/select-v2/XcSelectV2.vue'
 export {default as XcTableV3} from '../components/xiao-chan/table-v3/XcTableV3.vue'

+ 20 - 6
src/components/xiao-chan/dialog/XcDialog.vue

@@ -37,7 +37,7 @@
 </template>
 
 <script setup name='XcDialog' lang="ts">
-import {PropType, Ref, ref, watch, onMounted, nextTick} from "vue";
+import {Ref, ref, watch, onMounted, nextTick} from "vue";
 import {useDraggable} from '@vueuse/core'
 import {$ref} from "vue/macros";
 import {genTextPortrait} from '@/utils/portrait'
@@ -83,6 +83,14 @@ const props = defineProps({
   modelValue: {
     type: Boolean,
     default: false
+  },
+  x: {
+    type: Number,
+    default: null
+  },
+  y: {
+    type: Number,
+    default: null
   }
 })
 const emit = defineEmits(['closed', 'update:modelValue'])
@@ -154,11 +162,17 @@ watch(() => draggable.value?.y, async () => {
 })
 
 const calculationDisplayPosition = () => {
-  let top = (window.innerHeight * (props.top / 100))
-  let left = (window.innerWidth / 2) - (getDialogWidth() / 2);
-  draggable.value = useDraggable(dialogHeadRef, {
-    initialValue: {x: left as number, y: top as number},
-  });
+  if (props.x === null || props.y === null) {
+    let top = (window.innerHeight * (props.top / 100))
+    let left = (window.innerWidth / 2) - (getDialogWidth() / 2);
+    draggable.value = useDraggable(dialogHeadRef, {
+      initialValue: {x: left as number, y: top as number},
+    });
+  } else {
+    draggable.value = useDraggable(dialogHeadRef, {
+      initialValue: {x: props.x, y: props.y},
+    });
+  }
 }
 
 const getDialogWidth = () => {

+ 0 - 45
src/components/xiao-chan/input-and-dialog/InputAndDialog.vue

@@ -1,45 +0,0 @@
-<template>
-  <el-input v-model="props.modelValue"
-            @focus="getFocus"
-            style="width: 120px"
-            @click="getFocus"/>
-
-  <XcDiaLog :data="props" v-if="dialog"></XcDiaLog>
-
-</template>
-
-<script setup name='InputAndDialog'>
-import XcDiaLog from "@/components/xiao-chan/input-and-dialog/XcDiaLog.vue";
-
-const props = defineProps({
-  modelValue: {
-    type: String,
-    default: ''
-  },
-  title: {
-    type: String,
-    default: '数据搜索'
-  },
-  data: {
-    type: Object,
-    default: {
-      currentPage: 1,
-      total: 0,
-      data: []
-    }
-  }
-})
-
-const emit = defineEmits(['focus', 'change'])
-
-let dialog = $ref(false)
-
-const getFocus = () => {
-  dialog = !dialog
-}
-
-</script>
-
-<style scoped>
-
-</style>

+ 0 - 16
src/components/xiao-chan/input-and-dialog/VDialog.js

@@ -1,16 +0,0 @@
-const dialog = {
-    mounted(el, binding, vnode) {
-        // console.log(vnode.children[0].focus())
-        console.log(el, binding, vnode)
-        // document.body.innerHTML = `<span>123123</span>`
-    }
-}
-
-const handler = (MouseEvent) => {
-    console.log(MouseEvent)
-}
-
-window.addEventListener('click', handler)
-
-
-export default dialog

+ 0 - 49
src/components/xiao-chan/input-and-dialog/XcDiaLog.vue

@@ -1,49 +0,0 @@
-<template>
-  <el-dialog v-model="dialog" :title="data.title">
-    <el-container>
-
-      <el-main>
-
-        <div style="display: flex">
-          搜索方式:
-          <div v-for="item in searchMethod">
-            <div style="width: 60px;line-height: 20px;
-            text-align: center" class="finger">{{ item.name }}
-            </div>
-          </div>
-        </div>
-
-      </el-main>
-
-    </el-container>
-    <slot/>
-  </el-dialog>
-</template>
-
-<script setup name='XcDiaLog'>
-const props = defineProps({
-  data: {
-    type: Object,
-  }
-})
-
-let dialog = $ref(true)
-let data = props.data
-
-let searchMethod = $ref([
-  {code: 'alpha', name: '拼音'},
-  {code: 'code', name: '编码'},
-  {code: 'name', name: '名称'},
-])
-
-
-
-</script>
-
-<style scoped lang="scss">
-.finger:hover {
-  background-color: #0a84fd;
-  color: white;
-}
-
-</style>

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

@@ -260,11 +260,7 @@ const huanZheZhenDuan = ref({
 })
 
 const dianJiTianJiaZhuYaoZhenDuan = (val) => {
-  if (huiZhenShenQing.value.hzZd.length + val.length >= 100) {
-    ElMessage.error("主要诊断过长。")
-  } else {
-    huiZhenShenQing.value.hzZd += val + ','
-  }
+  huiZhenShenQing.value.hzZd += val + ','
 }
 
 const guanBi = () => {

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

@@ -1,19 +1,15 @@
 <template>
-  <div :style="style"
-       class="main xc_box 小手指">
-    <div ref="divRef" class="header">
-      <div style="flex: 1">上传提示</div>
-      <div class="circle_close " @click="close">
-        <el-icon :size="21">
-          <CircleClose/>
-        </el-icon>
-      </div>
-    </div>
+  <xc-dialog v-model="dialog"
+             title="错误信息"
+             :x="77"
+             :y="494"
+             width="420px">
     <div class="box">
-      <div v-for="(value, key) in tips"
-           class="message"
-           :class="props.currentKey === key ? 'current_selected' : '' "
-           @click="clickToModify(key,value)">
+      <div
+          v-for="(value, key) in props.data"
+          class="message"
+          :class="props.currentKey === key ? 'current_selected' : '' "
+          @click="clickToModify(key,value)">
         <div class="name">
           {{ value?.data?.orderName }}
         </div>
@@ -36,144 +32,84 @@
         </div>
       </div>
     </div>
-
-  </div>
-
+  </xc-dialog>
 </template>
 
 <script setup name='BaoCunXinXi' lang="ts">
-import {useDraggable} from '@vueuse/core'
-import {delCallback, setCallback} from "@/utils/websocket";
 import {$ref} from "vue/macros";
-import {onMounted, onUnmounted, Ref, ref, watch} from "vue";
+import XcDialog from "../../xiao-chan/dialog/XcDialog.vue";
 
 const props = defineProps({
-  data: Object,
+  data: {
+    type: [Map, Object]
+  },
   currentKey: [String, Number]
 })
 
-const emit = defineEmits(['openOrCloseErrorMsg', 'clickError'])
-
-const divRef: Ref<Document> = ref(null)
-
-const {x, y, style} = useDraggable(divRef, {
-  initialValue: {x: 77, y: 494},
-});
-
-interface yzMessage {
-  data: object,
-  error: Array<string>,
-  warning: Array<string>,
-}
-
-let tips: Map<string, yzMessage> = $ref(new Map<string, yzMessage>())
+const emit = defineEmits(['clickError'])
 
-const close = () => {
-  emit('openOrCloseErrorMsg', false)
-}
+let dialog = $ref(false)
 
 const clickToModify = (key, value) => {
-  emit('clickError', value?.data)
+  if (props.currentKey === key) return
+  emit('clickError', value)
 }
 
-onMounted(() => {
-  setCallback('updatedOrder', (data: Map<string, yzMessage>) => {
-    tips = data
-    emit('openOrCloseErrorMsg', true)
-  })
-})
-
-
-onUnmounted(() => {
-  delCallback('updatedOrder')
-})
-
-/**
- * 删除指定key
- * @param key
- */
-const clearKey = (key) => {
-  delete tips[key]
+const open = () => {
+  dialog = true
 }
 
 defineExpose({
-  clearKey
+  open
 })
 
 </script>
 
 <style scoped lang="scss">
 
-.main {
-  position: fixed;
-  width: 350px;
-  z-index: 99999;
-  background-color: white;
-  border-radius: 5px;
-
-
-  .header {
-    border-bottom: 1px solid #000;
-    width: 100%;
-    line-height: 35px;
-    text-align: center;
-    display: flex;
-    position: relative;
-
-    .circle_close {
-      position: absolute;
-      display: flex;
-      right: 0;
-      justify-content: center;
-      align-items: center;
-      width: 35px;
-      height: 100%;
-    }
-  }
-
-  .box {
-    margin: 5px;
-    padding: 4px;
-    max-height: 300px;
-    overflow: auto;
 
-    .current_selected {
-      border: 1px solid #0a84fd !important;
+.box {
+  margin: 5px;
+  padding: 4px;
+  max-height: 300px;
+  overflow: auto;
 
-      .name {
-        background-color: #0a84fd !important;
-      }
+  .current_selected {
+    border: 1px solid #0a84fd !important;
 
+    .name {
+      background-color: #0a84fd !important;
     }
 
-    .message {
-      border: 1px dashed #000;
+  }
+
+  .message {
+    border: 1px dashed #000;
+    padding: 5px;
+    border-radius: 4px;
+    margin: 5px 0;
+
+    .name {
       padding: 5px;
-      border-radius: 4px;
-      margin: 5px 0;
+      border-radius: 5px;
+      background-color: #2c3e50;
+      color: white;
+    }
 
-      .name {
-        padding: 5px;
-        border-radius: 5px;
-        background-color: #2c3e50;
-        color: white;
-      }
-
-      .error {
-        margin: 5px 0;
-        padding: 4px;
-        border-radius: 5px;
-        background-color: #f89b9b;
-      }
-
-      .warning {
-        margin: 5px 0;
-        padding: 4px;
-        border-radius: 5px;
-        background-color: #f5e1b8;
-      }
+    .error {
+      margin: 5px 0;
+      padding: 4px;
+      border-radius: 5px;
+      background-color: #f89b9b;
+    }
 
+    .warning {
+      margin: 5px 0;
+      padding: 4px;
+      border-radius: 5px;
+      background-color: #f5e1b8;
     }
+
   }
 }
 

+ 7 - 0
src/router/modules/dashboard.js

@@ -15,6 +15,13 @@ const route = [
         hideMenu: true,
         meta: {title: '电子病历', hideTabs: true},
     },
+    {
+        path: '/openNewWindow',
+        name: 'openNewWindow',
+        component: createNameComponent(() => import('@/views/hospitalization/zhu-yuan-yi-sheng/OpenNewWindiow.vue')),
+        hideMenu: true,
+        meta: {hideTabs: true},
+    },
     {
         path: '/triageRoomScreen',
         component: createNameComponent(() => import('@/views/clinic/triage/RoomScreen.vue')),

+ 18 - 0
src/utils/request.js

@@ -79,6 +79,7 @@ service.interceptors.response.use(
                 grouping: true,
             })
         } else if (response.data.code > 2000 && response.data.code < 3000) {
+
             if (response.data.code === 2003) {
                 ElMessageBox.alert(response.data.message, '提示', {
                     type: 'error',
@@ -107,6 +108,23 @@ service.interceptors.response.use(
         } else if (response.data.code === 5001) {
             createAPopup(response.data.message)
         }
+        if (response.data.code === 6001) {
+            ElMessage({
+                message: response.data.message,
+                type: 'error',
+                duration: 2500,
+                showClose: true,
+                grouping: true,
+            })
+            return Promise.reject(response.data.data)
+        } else if (response.data.code === 6002) {
+            ElMessageBox.alert(response.data.message, '提示', {
+                type: 'error',
+                confirmButtonText: '确定',
+            }).then(() => {
+            })
+            return Promise.reject(response.data.data)
+        }
         if (response.data.data) {
             return Promise.reject(response.data)
         }

+ 71 - 0
src/views/hospitalization/zhu-yuan-yi-sheng/OpenNewWindiow.vue

@@ -0,0 +1,71 @@
+<template>
+  <div v-if="show">
+    <div ref="divRef">
+      <br>
+      <huan-zhe-xin-xi :huan-zhe-xin-xi="patientInfo" v-if="patientInfo"/>
+    </div>
+    <emr-main :huan-zhe-xin-xi="patientInfo" :max-height="maxHeight" v-if="path === 'emr'"/>
+    <tian-jia-yi-zhu v-if="path === 'yzOrder'" :patient-info="patientInfo"/>
+  </div>
+</template>
+
+<script setup name='OpenNewWindow'>
+import EmrMain from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/EmrMain";
+import {getPatientInfo} from "@/api/inpatient/patient";
+import router from "@/router";
+import HuanZheXinXi from "@/components/zhu-yuan-yi-sheng/HuanZheXinXi.vue";
+import TianJiaYiZhu from "@/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/TianJiaYiZhu.vue";
+
+let show = $ref(false)
+let patientInfo = $ref({})
+const divRef = ref(null)
+
+let maxHeight = $ref()
+
+let path = $ref('')
+
+const emrFunc = async () => {
+  if (router.currentRoute.value.query?.patNo) {
+    show = true
+    await nextTick()
+    maxHeight = window.innerHeight - divRef.value?.clientHeight
+  } else {
+    show = false
+  }
+}
+
+/**
+ * 查询患者信息
+ * @returns {Promise<void>}
+ */
+const queryPatientInformation = async () => {
+  if (router.currentRoute.value.query?.patNo) {
+    patientInfo = await getPatientInfo(router.currentRoute.value.query.patNo)
+  }
+}
+
+
+const yzOrder = () => {
+
+  show = true
+}
+
+onActivated(async () => {
+  path = router.currentRoute.value.query.path
+  await queryPatientInformation()
+  switch (path) {
+    case "yzOrder":
+      yzOrder()
+      break;
+    case "emr":
+      await emrFunc();
+      break;
+  }
+})
+
+
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 3 - 8
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.js

@@ -5,11 +5,7 @@ import {baseinfo} from "@/data/inpatient";
 import {huoQuGeRenPinLv} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
 
 // 获取患者的频率数据
-export const huanZhePinLvData = ref([
-    {code: 0, name: '全部'},
-    {code: 1, name: '临时医嘱'},
-    {code: 2, name: '长期医嘱'}
-])
+export const huanZhePinLvData = ref([{code: 0, name: '全部'}, {code: 1, name: '临时医嘱'}, {code: 2, name: '长期医嘱'}])
 // 患者信息
 export const huanZheXinXi = computed(() => {
     return baseinfo()
@@ -24,9 +20,7 @@ export const cuoWuXinXi = ref('')
 export function youWuXuanZheHuanZhe() {
     if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
         ElMessage({
-            message: '请先选择患者',
-            showClose: true,
-            type: 'error'
+            message: '请先选择患者', showClose: true, type: 'error'
         })
         return true
     }
@@ -66,3 +60,4 @@ export function shouShuDengJi(val) {
 
 export let zkList = ref([])
 
+

+ 115 - 72
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/TianJiaYiZhu.vue

@@ -1,16 +1,5 @@
 <template>
-  <!-- 上传信息提示 -->
-  <bao-cun-xin-xi v-show="showErrorMessage"
-                  @clickError="clickError"
-                  :currentKey="yiZhuData.id"
-                  @openOrCloseErrorMsg="openOrCloseErrorMsg"
-                  ref="baoCunXinXiRef"/>
-  <!-- 这里是获取模板的 -->
-  <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">
       提示信息:
@@ -21,12 +10,12 @@
       </div>
     </div>
   </div>
-  <el-button icon="ArrowLeft" style="font-size: 14px" text type="primary" @click="router.go(-1)">返回</el-button>
+  <el-button icon="ArrowLeft" style="font-size: 14px" text type="primary" @click="cloneWindow">返回</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>
   {{ count }}
-  <el-button @click="showErrorMessage = true">打开错误信息</el-button>
+  <el-button @click="openErrorDialog">打开错误信息</el-button>
   <el-divider direction="vertical"/>
   <el-button :disabled="yiZhuData.serial === '00' || stringIsBlank(yiZhuData.serial)"
              icon="View"
@@ -79,7 +68,7 @@
                            :min="0"
                            ref="doseRef"
                            id="yz_dose"
-                           :precision="2"
+                           :precision="yiZhuData.doseUnitName === yiZhuData.miniUnitName ? 0 : 2"
                            style="width: 110px"
                            @change="jiSuanLingLiang"/>
           <XcSelect v-model="yiZhuData"
@@ -93,7 +82,15 @@
         </el-form-item>
       </el-col>
       <el-col :span="span">
-        <el-form-item label="领量:"> {{ yiZhuData.drugQuan }} {{ yiZhuData.miniUnitName }}</el-form-item>
+        <el-form-item label="领量:">
+          <el-input-number v-model="yiZhuData.drugQuan"
+                           :min="minimumPickingQuantity"
+                           placeholder="请输入领量">
+            {{ yiZhuData.drugQuan }}
+          </el-input-number>
+          &nbsp;&nbsp;&nbsp;
+          {{ yiZhuData.miniUnitName }}
+        </el-form-item>
       </el-col>
       <el-col :span="span">
         <el-form-item class="bi_tian" label="给药方式:" prop="supplyCode">
@@ -280,8 +277,7 @@
                        :value="item.code">
               <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
               <el-divider direction="vertical"></el-divider>
-              <span>{{ item.name }}</span></el-option
-            >
+              <span>{{ item.name }}</span></el-option>
           </el-select>
         </el-form-item>
       </el-col>
@@ -361,7 +357,8 @@
   <sou-suo-yi-zhu v-if="yiZhuMingDialog" @close="closeTheDoctorSOrderSearchBox()"
                   @xuanZhongFeiYong="xuanZhongFeiYong"></sou-suo-yi-zhu>
   <!-- 这个是过敏源的 -->
-  <AllergenEntry v-if="allergenDialog" :pat-no="huanZheXinXi.inpatientNo"
+  <AllergenEntry v-if="allergenDialog"
+                 :pat-no="props.patientInfo.inpatientNo"
                  @close="allergenDialog = false"></AllergenEntry>
   <yao-ping-xiang-qing v-if="drugProblem.dialog"
                        :url="drugProblem.url"
@@ -369,6 +366,19 @@
   <yao-ping-xiang-qing v-if="synopsisDialog.dialog"
                        :code="synopsisDialog.code"
                        @close="synopsisDialog.dialog = false"/>
+
+  <!-- 上传信息提示 -->
+  <bao-cun-xin-xi @clickError="clickError"
+                  :data="errorMessageData"
+                  :currentKey="yiZhuData.id"
+                  ref="baoCunXinXiRef"/>
+  <!-- 这里是获取模板的 -->
+  <huo-qu-mu-ban v-if="muBanDuiHuaKuang"
+                 @close="muBanDuiHuaKuang = false"
+                 @muBanShuJu="muBanShuJu"/>
+  <!-- 保存模板用 -->
+  <bao-cun-mu-ban v-if="baoCunMuBanRef" v-model="baoCunMuBanRef" :list="yiZhuList"/>
+
 </template>
 
 <script name="TianJiaYiZhu" setup="props,context">
@@ -377,15 +387,12 @@ import {
   huoQuGeiYaoFangShi,
   huoQuZhiXinKeShi,
   huoQuZhuYuanPinLv,
-  jiaoYan, saveTheDoctorSOrder,
-  shangChuanYiZhu, singleDataCheck
+  saveTheDoctorSOrder,
+  singleDataCheck
 } from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
 import {
-  cuoWuXinXi,
   fuZhiYiZhu,
   getSelfBuy,
-  huanZheXinXi,
-  youWuXuanZheHuanZhe,
   zkList
 } from '@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng'
 import store from '../../../../store'
@@ -396,7 +403,7 @@ import {clone} from '@/utils/clone'
 import HuoQuMuBan from '../../../../components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/HuoQuMuBan.vue'
 import {uuid} from '@/utils/getUuid'
 import BaoCunMuBan from '../../../../components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/BaoCunMuBan.vue'
-import {getServerDateApi, whetherThePatientHasAllergens, yaoPinXiangMuPiPeiYiBao} from '@/api/public-api'
+import {getServerDateApi, whetherThePatientHasAllergens} from '@/api/public-api'
 import router from '@/router'
 import SouSuoYiZhu from '@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/SouSuoYiZhu.vue'
 import YaoPingXiangQing from '@/components/zhu-yuan-yi-sheng/he-li-yong-yao/YaoPingXiangQing.vue'
@@ -409,6 +416,14 @@ import XcTableV3 from "@/components/xiao-chan/table-v3/XcTableV3.vue";
 import sleep from "@/utils/sleep";
 import BaoCunXinXi from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/BaoCunXinXi.vue";
 
+
+const props = defineProps({
+  patientInfo: {
+    type: Object,
+    default: null
+  }
+})
+
 const windowSize = computed(() => {
   return store.state.app.windowSize
 })
@@ -499,11 +514,11 @@ let yiZhuMingDialog = $ref(false)
 const xuanZhongFeiYong = async (row) => {
   fuYiZhuClick()
   qingKong()
-  await Sleep(600)
+  await Sleep(200)
   closeTheDoctorSOrderSearchBox()
   yiZhuData.value = row
   if (row.serial !== '00') {
-    huoQuFeiYongXinXi(row.orderCode, row.serial, huanZheXinXi.value.smallDept)
+    huoQuFeiYongXinXi(row.orderCode, row.serial, props.patientInfo.smallDept)
         .then((res) => {
           yiZhuData.value.drugFlag = row.drugFlag ? row.drugFlag : row.orderType
           // 判断是否 是皮试的药 如果是就只能有这些 给药方式
@@ -528,7 +543,7 @@ const xuanZhongFeiYong = async (row) => {
             yiZhuData.value.doseUnit = yaoPinJiLiangData.value[0].code
             yiZhuData.value.dose = yaoPinJiLiangData.value[0].value
             jiLiangValue.value = yaoPinJiLiangData.value[0].value
-            jiSuanLingLiang(yaoPinJiLiangData.value[0].value)
+            jiSuanLingLiang(yiZhuData.value.dose)
           }
           // 加载默认频率 如果已经填写了 就用有的
           if (stringIsBlank(row.frequCode)) {
@@ -556,7 +571,7 @@ const xuanZhongFeiYong = async (row) => {
         })
   } else {
     yiZhuData.value.kjywFlag = 0
-    huoQuFeiYongXinXi(row.orderCode, '00', huanZheXinXi.value.smallDept)
+    huoQuFeiYongXinXi(row.orderCode, '00', props.patientInfo.smallDept)
         .then((res) => {
           yiZhuData.value.drugFlag = row.drugFlag ? row.drugFlag : row.orderType
           if (stringNotBlank(res.prompt)) {
@@ -582,13 +597,13 @@ const xuanZhongFeiYong = async (row) => {
   })
   // 用来加载默认的执行科室
   if (stringIsBlank(row.execUnit)) {
-    if (stringNotBlank(huanZheXinXi.value.smallDept)) {
-      yiZhuData.value.execUnit = huanZheXinXi.value.smallDept
-      yiZhuData.value.execUnitName = huanZheXinXi.value.smallDeptName
+    if (stringNotBlank(props.patientInfo.smallDept)) {
+      yiZhuData.value.execUnit = props.patientInfo.smallDept
+      yiZhuData.value.execUnitName = props.patientInfo.smallDeptName
     }
-  } else if (huanZheXinXi.value.smallDept && row.execUnit.startsWith("8")) {
-    yiZhuData.value.execUnit = huanZheXinXi.value.smallDept
-    yiZhuData.value.execUnitName = huanZheXinXi.value.smallDeptName
+  } else if (props.patientInfo.smallDept && row.execUnit.startsWith("8")) {
+    yiZhuData.value.execUnit = props.patientInfo.smallDept
+    yiZhuData.value.execUnitName = props.patientInfo.smallDeptName
   }
   if (stringIsBlank(row.id)) {
     yiZhuData.value.id = uuid(8, 10)
@@ -624,15 +639,29 @@ const jiLiangValue = ref(0)
 const xuanZheJiLiang = (val) => {
   jiLiangValue.value = val.value
   yiZhuData.value.dose = val.value
-  yiZhuData.value.drugQuan = 1
+  jiSuanLingLiang(yiZhuData.value.dose)
 }
 /*计算领量*/
 const jiSuanLingLiang = (val) => {
-  if (jiLiangValue.value > 0) {
-    yiZhuData.value.drugQuan = Math.ceil(val / jiLiangValue.value)
+
+  if (jiLiangValue.value <= 0) return
+  let temp = Math.ceil(val / jiLiangValue.value);
+
+  minimumPickingQuantity = temp
+
+  if (!yiZhuData.value.drugQuan) {
+    yiZhuData.value.drugQuan = temp
   }
+
+  if (yiZhuData.value.drugQuan < temp) {
+    yiZhuData.value.drugQuan = temp
+  }
+
 }
 
+let minimumPickingQuantity = $ref(0)
+
+
 /* 给药方式 */
 const geiYaoFangShiData = ref([])
 const geiYaoFangShiRemoteMethod = (val) => {
@@ -688,9 +717,9 @@ const tianJiaYiZhu = () => {
   }
 
   let data = {
-    inpatientNo: huanZheXinXi.value.inpatientNo,
-    admissTimes: huanZheXinXi.value.admissTimes,
-    deptCode: huanZheXinXi.value.smallDept,
+    inpatientNo: props.patientInfo.inpatientNo,
+    admissTimes: props.patientInfo.admissTimes,
+    deptCode: props.patientInfo.smallDept,
     list: [yiZhuData.value],
   }
   singleDataCheck(data).then((res) => {
@@ -717,7 +746,8 @@ const tianJiaYiZhu = () => {
         yiZhuList.value.splice(index, 1)
         ElMessage.error('重复添加,老记录已删除。')
       }
-      baoCunXinXiRef.value.clearKey(yiZhuData.value.id)
+      // 在这里要删除指定的 错误信息 key
+      delete errorMessageData[yiZhuData.value.id]
       yiZhuList.value.push(res.data)
       qingKong()
     }
@@ -767,7 +797,7 @@ const expandChange = (row, expandedRows) => {
   if (feeInformation.has(row.id)) {
     return
   }
-  huoQuFeiYongXinXi(row.orderCode, row.serial, huanZheXinXi.value.smallDept).then((res) => {
+  huoQuFeiYongXinXi(row.orderCode, row.serial, props.patientInfo.smallDept).then((res) => {
     if (res.prompt) {
       feeInformation.set(row.id, res.prompt)
     }
@@ -791,13 +821,15 @@ const synopsis = (val) => {
 /* 保存信息 */
 const baoCunYiZhuClick = () => {
   disableShortcutKeys()
-  if (youWuXuanZheHuanZhe()) return
+
+  if (props.patientInfo === null) return ElMessage.error('请先选择患者')
+
   if (listIsBlank(yiZhuList.value)) {
     return ElMessage.error('请先选择数据')
   }
   let data = {
-    inpatientNo: huanZheXinXi.value.inpatientNo,
-    admissTimes: huanZheXinXi.value.admissTimes,
+    inpatientNo: props.patientInfo.inpatientNo,
+    admissTimes: props.patientInfo.admissTimes,
     list: yiZhuList.value,
   }
   ElMessageBox.confirm('是否确认医嘱?', '提示', {
@@ -806,24 +838,27 @@ const baoCunYiZhuClick = () => {
   }).then(() => {
     saveTheDoctorSOrder(data).then((res) => {
       ElMessage.success('医嘱确认成功')
-      router.go(-1)
+    }).catch((e) => {
+      console.log(e)
+      errorMessageData = e
+      openErrorDialog()
     }).finally(() => {
       enableShortcutKeys()
     })
   }).catch(() => {
   })
 
-
 }
 
 /* 医嘱错误信息 */
-let showErrorMessage = $ref(false)
-const baoCunXinXiRef = ref(null)
-// 打开或者关闭
-const openOrCloseErrorMsg = (val) => {
-  showErrorMessage = val
+let errorMessageData = $ref({})
+
+const openErrorDialog = () => {
+  baoCunXinXiRef.value.open()
 }
 
+const baoCunXinXiRef = ref(null)
+
 const clickError = (value) => {
   if (yiZhuData.value.orderCode) {
     ElMessage.warning({
@@ -833,7 +868,7 @@ const clickError = (value) => {
       grouping: true,
     })
   } else {
-    xuanZhongFeiYong(value)
+    xuanZhongFeiYong(value.data)
   }
 }
 
@@ -890,7 +925,10 @@ const baoCunMuBanClick = () => {
 
 // 医嘱限制时间不能在之前
 const disabledDate = (time) => {
-  return time.getTime() < new Date(huanZheXinXi.value.admissDate).getTime() - 8.64e7
+  if (props.patientInfo?.admissDate) {
+    return time.getTime() < new Date(props.patientInfo?.admissDate).getTime() - 8.64e7
+  }
+  return true
 }
 
 const xuanZhongShuJu = ref([])
@@ -911,7 +949,6 @@ const dianJiXiuGaiZhiXingKeShi = () => {
 }
 
 const qingKong = () => {
-  cuoWuXinXi.value = ''
   yaoPinJiLiangData.value = []
   jiLiangValue.value = 0
   tiShiBiaoTi.value = []
@@ -1158,8 +1195,6 @@ const enterToJumpInput = async (val) => {
 /* 回车按下 跳转到下一个 input , 暂时未启用 end */
 
 onMounted(async () => {
-  // huanZheXinXi.value.inpatientNo = '0409327'
-  // huanZheXinXi.value.admissTimes = 1
   xcHotKey(shortcutKeyRegistration)
   yiZhuList.value = clone(fuZhiYiZhu.value)
   let serverTime = await getServerDateApi();
@@ -1171,29 +1206,37 @@ onMounted(async () => {
     yiZhuList.value[i].frequCodeName = '一次'
     yiZhuList.value[i].frequCode = 'ONCE'
   }
-  if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
+  if (stringIsBlank(props.patientInfo.inpatientNo)) {
+    document.title = '医嘱模板编辑'
     ElMessage.warning('您现在进入的是医嘱模板编辑')
   } else {
+    document.title = `医嘱录入:【${props.patientInfo.name}】`
     ElMessage.warning('您现在进入的是医嘱编辑模块,' + '您的编辑时间有 30 分钟,你准备好了吗?')
     kaiQiDaoJiShi()
-    whetherThePatientHasAllergens(huanZheXinXi.value.inpatientNo).then((res) => {
+    whetherThePatientHasAllergens(props.patientInfo.inpatientNo).then((res) => {
       allergenDialog = res
     })
   }
-  if (stringNotBlank(huanZheXinXi.value.inpatientNo)) {
+  if (stringNotBlank(props.patientInfo.inpatientNo)) {
     zhiXingKeShiData.value = [
       {
-        value: huanZheXinXi.value.smallDept,
-        label: huanZheXinXi.value.smallDeptName,
-        code: huanZheXinXi.value.smallDept,
-        name: huanZheXinXi.value.smallDeptName,
+        value: props.patientInfo.smallDept,
+        label: props.patientInfo.smallDeptName,
+        code: props.patientInfo.smallDept,
+        name: props.patientInfo.smallDeptName,
       },
     ]
   }
   fuZhiYiZhu.value = []
-
+  testData()
 })
 
+
+const cloneWindow = () => {
+  window.opener = null
+  window.close()
+}
+
 const testData = () => {
   yiZhuList.value = [
     {
@@ -1219,8 +1262,8 @@ const testData = () => {
       "discription": "70.00元 次(自费项目)",
       "delFlag": "0",
       "serial": "01",
-      "execUnit": "8010100",
-      "execUnitName": "七病室",
+      "execUnit": "1010100",
+      "execUnitName": "普外科",
       "newActOrderNo": 0,
       "currentPage": 0,
       "parentNo": 14798,
@@ -1258,7 +1301,7 @@ const testData = () => {
       "discription": "400.00元 每个部位(自费项目)",
       "delFlag": "0",
       "serial": "01",
-      "execUnit": "1010100",
+      "execUnit": "8000007",
       "execUnitName": "七病室",
       "newActOrderNo": 0,
       "currentPage": 0,
@@ -1276,8 +1319,8 @@ const testData = () => {
     {
       "actOrderNo": 1111111,
       "orderCode": "01192",
-      "frequCode": "001",
-      "frequCodeName": "口服",
+      // "frequCode": "001",
+      // "frequCodeName": "口服",
       "drugFlag": "i",
       "supplyCode": "025",
       "supplyCodeName": "接瓶续滴",
@@ -1296,7 +1339,7 @@ const testData = () => {
       "discription": "400.00元 每个部位(自费项目)",
       "delFlag": "0",
       "serial": "01",
-      "execUnit": "1010100",
+      "execUnit": "8000007",
       "execUnitName": "七病室",
       "newActOrderNo": 0,
       "currentPage": 0,

+ 18 - 11
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/YiZhuLuRu.vue

@@ -183,10 +183,16 @@ import {
   piLiangXiuGaiTingZhiShiJian,
   yiZhuChaoZuo
 } from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
-import {fuZhiYiZhu, huanZhePinLvData, huanZheXinXi, youWuXuanZheHuanZhe, zkList} from '../public-js/zhu-yuan-yi-sheng'
+import {
+  fuZhiYiZhu,
+  huanZhePinLvData,
+  huanZheXinXi,
+  youWuXuanZheHuanZhe,
+  zkList
+} from '../public-js/zhu-yuan-yi-sheng'
 import {getDateRangeFormatDate} from '@/utils/date'
 import store from '@/store'
-import {stringIsBlank} from '@/utils/blank-utils'
+import {stringIsBlank, stringNotBlank} from '@/utils/blank-utils'
 import {getServerDateApi, getTheTransferList} from '@/api/public-api'
 import router from '@/router'
 import XcTable from "@/components/xiao-chan/xc-table/XcTable.vue";
@@ -297,16 +303,16 @@ const clearSelection = () => {
  * 下面这里是添加医嘱了
  */
 const addYiZhuClick = () => {
-  router.push({
-    name: 'xinZengShuJu',
-    params: {
-      passRule: true,
-      name: '添加医嘱',
-    },
+
+  let routeData = router.resolve({
+    name: 'openNewWindow',
     query: {
-      path: '/inpatient/zhuYuanYiSheng/yiZhuLuRu',
+      patNo: huanZheXinXi.value.inpatientNo,
+      times: huanZheXinXi.value.admissTimes,
+      path: 'yzOrder'
     },
   })
+  window.open(routeData.href, '_blank');
 }
 
 /**
@@ -315,10 +321,11 @@ const addYiZhuClick = () => {
 const openElectronicMedicalRecord = () => {
   if (youWuXuanZheHuanZhe()) return
   let routeData = router.resolve({
-    name: 'emrEditor',
+    name: 'openNewWindow',
     query: {
       patNo: huanZheXinXi.value.inpatientNo,
-      times: huanZheXinXi.value.admissTimes
+      times: huanZheXinXi.value.admissTimes,
+      path: 'emr'
     },
   })
   window.open(routeData.href, '_blank');