xiaochan преди 1 година
родител
ревизия
c38da11a0b

+ 4 - 4
src/components/SelectStaffCode.vue

@@ -18,7 +18,7 @@
   </el-select>
 </template>
 
-<script name="SelectStaffCode" setup>
+<script setup>
 import {getRenYuan} from "@/api/public-api";
 import {stringNotBlank} from "@/utils/blank-utils";
 import store from "@/store";
@@ -51,13 +51,13 @@ const selectValue = ref()
 
 const modelChange = () => {
   selectValue.value = props.modelValue[props.name[0]]
-  if (stringNotBlank(value)) {
+  if (stringNotBlank(selectValue.value)) {
     for (let i = 0, len = staffList.value.length; i < len; i++) {
-      if (value === staffList.value[i].code) {
+      if (selectValue.value === staffList.value[i].code) {
         return
       }
     }
-    getRenYuan(value).then(res => {
+    getRenYuan(selectValue.value).then(res => {
       staffList.value = res
     })
   }

+ 132 - 0
src/components/cy/floating-frame/FloatingFrame.vue

@@ -0,0 +1,132 @@
+<script setup lang="ts">
+import {useDraggable, useZIndex} from "element-plus";
+import XEUtils from "xe-utils";
+import {Close} from "@element-plus/icons-vue";
+import {onDeactivated} from "@vue/runtime-core";
+
+const props = withDefaults(defineProps<{
+  width?: string | number,
+  height?: string | number,
+  x?: string | number,
+  y?: string | number,
+  title?: string,
+  modelValue: boolean
+}>(), {
+  width: '300px',
+  height: '400px',
+  x: 30,
+  y: 40,
+  title: '标题'
+})
+
+const emits = defineEmits<{
+  (e: "update:modelValue", value: boolean): void,
+}>()
+
+const vodyRef = ref()
+const vRef = ref()
+const zIndex = ref(useZIndex().nextZIndex())
+const draggable = computed(() => {
+  return true
+})
+
+const isNumberAddUnit = (val: number | string, unit: string = 'px') => {
+  return XEUtils.addUnit(val)
+}
+
+const boxStyle = computed(() => {
+  return {
+    height: isNumberAddUnit(props.height),
+    width: isNumberAddUnit(props.width),
+    left: isNumberAddUnit(props.x),
+    top: isNumberAddUnit(props.y),
+    zIndex: zIndex.value
+  }
+})
+
+watch(() => props.modelValue, (value, oldValue, onCleanup) => {
+  if (value)
+    zIndex.value = useZIndex().nextZIndex()
+})
+
+useDraggable(vodyRef, vRef, draggable)
+
+onDeactivated(() => {
+  emits('update:modelValue', false)
+})
+
+onUnmounted(() => {
+  emits('update:modelValue', false)
+})
+
+</script>
+
+<template>
+  <transition name="el-fade-in-linear">
+    <div class="floating_frame-box"
+         :style="boxStyle"
+         v-show="props.modelValue"
+         ref="vodyRef">
+      <header class="floating_frame-drag_reference" ref="vRef">
+        <div class="floating_frame-title">
+          {{ props.title }}
+        </div>
+        <div class="floating_frame-close_icon">
+          <el-icon :size="16" @click="emits('update:modelValue' , false)">
+            <Close/>
+          </el-icon>
+        </div>
+      </header>
+      <div class="floating_frame-body">
+        <slot/>
+      </div>
+    </div>
+  </transition>
+</template>
+
+<style scoped lang="scss">
+.floating_frame-box {
+  position: fixed;
+  box-sizing: border-box;
+  border-radius: 5px;
+  background: white;
+  box-shadow: var(--el-box-shadow);
+  padding: 5px 16px;
+
+  div {
+    box-sizing: border-box;
+    background: white;
+  }
+
+  .floating_frame-drag_reference {
+    height: 30px;
+    width: 100%;
+    cursor: all-scroll;
+    user-select: none;
+    position: relative;
+    border-bottom: 1px solid var(--el-border-color);
+
+    .floating_frame-title {
+      text-align: center;
+      line-height: 30px;
+    }
+
+    .floating_frame-close_icon {
+      position: absolute;
+      height: inherit;
+      width: 30px;
+      right: 0;
+      display: flex;
+      top: 0;
+      justify-content: center;
+      align-items: center;
+      cursor: pointer;
+    }
+  }
+
+  .floating_frame-body {
+    height: calc(100% - 30px);
+    overflow: auto;
+  }
+}
+</style>

+ 1 - 0
src/components/cy/message-box/src/cy-message-box.ts

@@ -55,6 +55,7 @@ const MESSAGE_BOX_DEFAULT_OPTS: {
 }
 
 MESSAGE_BOX_VARIANTS.forEach(item => {
+    // @ts-ignore
     MessageBox[item] = messageBoxFactory(item)
 })
 

+ 1 - 10
src/components/xiao-chan/dialog/XcDialog.vue

@@ -36,20 +36,11 @@
   </Transition>
 </template>
 
-<script setup name='XcDialog' lang="ts">
+<script setup lang="ts">
 import {Ref, ref, watch, onMounted, nextTick, reactive} from "vue";
 import {useDraggable} from '@vueuse/core'
 import {genTextPortrait} from '@/utils/portrait'
 
-interface dialogConfig {
-  fullScreen: boolean,
-  title: string,
-  top?: number,
-  dialog: boolean,
-  img?: any,
-  width: '',
-}
-
 const props = defineProps({
   title: {
     type: String,

+ 3 - 3
src/components/zhu-yuan-yi-sheng/public/PatientList.vue

@@ -48,8 +48,8 @@
     </el-table-column>
   </el-table>
 
-  <xc-dialog-v2 v-model="thirdLevelDoctorSetting.dialog" width="450px" title="三级医生设置">
-    <el-form label-width="80px">
+  <el-dialog v-model="thirdLevelDoctorSetting.dialog" width="450px" title="三级医生设置">
+    <el-form label-width="120px">
       <el-form-item label="患者:">
         {{ thirdLevelDoctorSetting.data.name }}
       </el-form-item>
@@ -71,7 +71,7 @@
         <el-button @click="submitToTheThirdLevelDoctor">提交</el-button>
       </el-form-item>
     </el-form>
-  </xc-dialog-v2>
+  </el-dialog>
 </template>
 
 <script setup name='PatientList' lang="ts">

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

@@ -1,15 +1,14 @@
 <template>
-  <xc-dialog v-model="errorMsg.dialog"
-             title="错误信息"
-             :x="77"
-             :y="494"
-             width="420px">
+  <FloatingFrame v-model="errorMsg.dialog" title="错误信息"
+                 :x="77"
+                 :y="494"
+                 width="420px">
     <div class="box">
-      <div v-if="errorMsg.type === 1 || errorMsg.type === 3 "
-           v-for="(value, key) in errorMsg.type === 3 ? errorMsg.data : props.data"
+      <div v-if="errorMsg.type === YzErrTypeEnum.确认错误"
+           v-for="(value, key) in  errorMsg.data "
            class="message"
            :class="props.currentKey == key ? 'current_selected' : '' "
-           @click="clickToModify(key,value)">
+           @click="clickToModify(key)">
         <div class="name">
           医嘱号: {{ key }}
           序号:{{ getYzIndex(key) + 1 }}
@@ -33,7 +32,7 @@
           </div>
         </div>
       </div>
-      <div v-if="errorMsg.type === 2">
+      <div v-if="errorMsg.type === YzErrTypeEnum.删除错误">
         <div v-for="item in errorMsg.data"
              class="delete__box">
           <div>
@@ -46,32 +45,35 @@
       </div>
 
     </div>
-  </xc-dialog>
+  </FloatingFrame>
 </template>
 
-<script setup>
-import XcDialog from "../../xiao-chan/dialog/XcDialog.vue";
-import {errorMsg, getYzIndex} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
+<script setup lang="ts">
+import {
+  errorMsg,
+  getYzIndex,
+  YzErrTypeEnum
+} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 import XEUtils from 'xe-utils'
+import FloatingFrame from "@/components/cy/floating-frame/FloatingFrame.vue";
 
 const props = defineProps({
-  data: {
-    type: [Map, Object]
-  },
   currentKey: [String, Number]
 })
 
-const emit = defineEmits(['clickError'])
+const emit = defineEmits<{
+  (e: "clickError", orderNo: number): void
+}>()
 
 
-const clickToModify = (key, value) => {
+const clickToModify = (key) => {
   if (props.currentKey === key) return
   emit('clickError', XEUtils.toNumber(key))
 }
 
 const openOrClose = (val = true) => {
   errorMsg.value.dialog = val
-  errorMsg.value.type = 1
+  errorMsg.value.type = YzErrTypeEnum.确认错误
 }
 
 defineExpose({

+ 8 - 36
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/dialog/YzDialog.vue

@@ -1,7 +1,7 @@
 <template>
-  <xc-dialog-v2 v-model="dialog"
-                title="特殊医嘱"
-                @closed="emits('closed')">
+  <el-dialog v-model="dialog"
+             title="特殊医嘱"
+             @closed="emits('closed')">
     <span style="color: red">
       请注意,填写完成后需要,录入医嘱才会保存这些信息,点击确认和关闭是不会保存信息的,复制粘贴医嘱是不会同步复制这些信息,需要再次填写。
     </span>
@@ -75,35 +75,29 @@
       </el-select>
     </div>
     <template #footer>
-      <el-button @click="cancel">取消</el-button>
-      <el-button @click="dialog = false">确认</el-button>
+      <el-button @click="cancel" type="danger">取消</el-button>
+      <el-button @click="dialog = false" type="primary">确认</el-button>
     </template>
-  </xc-dialog-v2>
+  </el-dialog>
 </template>
 
-<script setup name='YzDialog'>
-import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2";
+<script setup>
 import {yiZhuData, zkList} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 import {kangJunYaoWuQieKou, kangJunYaoWuYongYaoFangShi, kangJunYaoWuYongYaoShiJian} from '@/data'
 
 const props = defineProps({
   yzData: {
     type: Object,
-    default: {
-      orderCode: '06054'
-    }
   }
 })
 
 const emits = defineEmits(['closed'])
 
-// 科医嘱
+// 科医嘱
 const zkCode = '06286'
 // 处置医嘱
 const czCode = '06054'
 
-const specialOrders = ['06286', '06054']
-
 const dialog = ref(true)
 
 const zkChange = () => {
@@ -121,34 +115,12 @@ const kangJunYaoYongYaoFangShiGaiBian = (val) => {
   }
 }
 
-
-const openOrClose = (val) => {
-  if (yiZhuData.value.statusFlag !== '1') {
-    return
-  }
-
-  if (val) {
-    if (specialOrders.includes(yiZhuData.value.orderCode)) {
-      dialog.value = true
-    } else if (yiZhuData.value.kjywFlag === 1) {
-      dialog.value = true
-    }
-  } else {
-    dialog.value = val
-  }
-}
-
 const cancel = () => {
   if (yiZhuData.value.orderCode === '06054') {
     yiZhuData.value.orderName = '处置医嘱'
   }
   dialog.value = false
 }
-
-defineExpose({
-  openOrClose
-})
-
 </script>
 
 <style lang="scss" scoped>

+ 16 - 227
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/yz-edit/YzEditor.vue

@@ -1,5 +1,4 @@
 <template>
-  <doctor-authorization/>
   <div ref="editorMainRef" style="width: max-content">
     <div class="editor__title" style="height: 10px; width: 100%">
         <span v-for="item in tiShiBiaoTi">
@@ -234,9 +233,7 @@
     </div>
     <!--  报错信息  -->
     <bao-cun-xin-xi @clickError="clickError"
-                    :data="errorMessageData"
-                    :currentKey="yiZhuData.actOrderNo"
-                    ref="baoCunXinXiRef"/>
+                    :currentKey="yiZhuData.actOrderNo"/>
     <!--  弹窗医嘱  -->
     <yz-dialog :yz-data="yiZhuData" v-if="yzDialogRef" @closed="yzDialogRef = false"/>
   </div>
@@ -277,7 +274,7 @@ import {
   frequencyConfig,
   addTempOrderNo,
   yiZhuDataInit,
-  setOrderDataAndTwinkle, feeKey, YzType, SearchOrdersType, RefFillingValue
+  setOrderDataAndTwinkle, feeKey, YzType, SearchOrdersType, RefFillingValue, errorMsg, YzErrTypeEnum
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 import {ElMessageBox} from "element-plus";
 import YzDialog from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/dialog/YzDialog";
@@ -301,6 +298,7 @@ import {
 import {userInfoStore} from "@/utils/store-public";
 import {getServerDate} from "@/utils/moment-utils";
 import {CyMessageBox} from "@/components/cy/message-box";
+import setDialogToJs from "@/components/js-dialog-comp/useDialogToJs";
 
 const props = withDefaults(defineProps<{
   patientInfo: {
@@ -400,7 +398,6 @@ const rowClickFillData = async (data: YzType) => {
     await itemDefaultValue(false, data)
   }
   await defaultAll(false, data)
-
 }
 
 const clearAndErrorMessage = (message: string) => {
@@ -423,13 +420,12 @@ const drugDefaultValue = async (isSearch: boolean, data: SearchOrdersType | YzTy
 
   // 医生没有权限
   if (permissionPrompt) {
-    await yzMitt.emit('openDoctorAuthoriztion', drugKey)
-        .then((res) => {
-          setYzData('superiorDoctor', res.code)
-        })
-        .catch(() => {
-          clearAndErrorMessage('取消授权。')
-        })
+    await setDialogToJs(DoctorAuthorization, {drugCode: drugKey}).then((res) => {
+      const [us] = res
+      setYzData('superiorDoctor', us.code)
+    }).catch(() => {
+      clearAndErrorMessage('取消授权。')
+    })
   }
 
   // 加载药品的计量
@@ -579,205 +575,6 @@ const setYzData = (name: keyof YzType, value: any): void => {
 
 /*提示信息*/
 const tiShiBiaoTi = ref([])
-// 填充数据
-const xuanZhongFeiYong = async (row, laiyuan = 1) => {
-  // 这里是用的模板数据
-  if (row.serial === '0000' && row.groupNo === '0000') {
-    props.openGroupOrderTemplate(row.orderCode);
-    return;
-  }
-  if (row.serial === '00' && isCydy()) {
-    qingKong()
-    return BizException(ExceptionEnum.LOGICAL_ERROR, '出院带药不能开项目')
-  }
-
-  // 如果是搜索的医嘱的话就需要给一个新的医嘱号
-  if (laiyuan === 1) {
-    // 如果是在原来有的医嘱上搜索的话就不要给医嘱号了。
-    if (stringIsBlank(yiZhuData.value.actOrderNo) || yiZhuData.value.actOrderNo === addTempOrderNo) {
-      yiZhuData.value.actOrderNo = parseInt(await getOrderNo())
-      yiZhuData.value.newOrderFlag = 1
-    }
-  }
-
-  let tempOrderNo = null
-  // 查询医嘱是不会有医嘱号的,医生会在原来的医嘱上面修改成项目或者药品
-  // 保留一下医嘱号 不然  yiZhuData.value = row 这个会把医嘱号给干掉
-  if (laiyuan === 1) {
-    tempOrderNo = yiZhuData.value.actOrderNo
-  }
-  fuYiZhuClick()
-  qingKong()
-  await Sleep(200)
-  // 克隆一下数据防止有问题
-  yiZhuData.value = clone(row) as YzType
-  if (tempOrderNo !== null) {
-    yiZhuData.value.actOrderNo = tempOrderNo;
-    yiZhuData.value.statusFlag = '1'
-  }
-  let newData = yiZhuData.value.statusFlag === '1'
-  // 00 是项目
-  if (row.serial !== '00') {
-    try {
-      let queryKey2 = feeKey(row.orderCode, row.serial, props.patientInfo.zkWard, queryParam.value.groupNo, yiZhuData.value.superiorDoctor, yiZhuData.value.statusFlag)
-      let res = await huoQuFeiYongXinXi(queryKey2)
-      if (res.permissionPrompt) {
-        let authorization = await yzMitt.emit('openDoctorAuthoriztion', row.orderCode + '_' + row.serial)
-        yiZhuData.value.superiorDoctor = authorization.code
-      }
-      // 加载药品计量
-      yaoPinJiLiangData.value = res.yaoPingJiLiang;
-      if (newData) {
-        // 是否是 抗菌药物
-        yiZhuData.value.kjywFlag = res.data.kjywFlag
-        // 提示信息
-        tiShiBiaoTi.value = res.prompt
-        // 最小单位名称
-        if (laiyuan === 1) {
-          yiZhuData.value.miniUnit = res.data.packUnit;
-          yiZhuData.value.miniUnitName = res.data.packUnitName;
-        }
-        yiZhuData.value.packSize = res.data.packSize
-        yiZhuData.value.packUnit = res.data.packUnit
-        yiZhuData.value.drugVolume = res.data.volum
-        yiZhuData.value.drugVolUnit = res.data.volUnit
-        // 加载 剂量单位
-        if (stringNotBlank(yiZhuData.value.doseUnit)) {
-          yaoPinJiLiangData.value.forEach((item) => {
-            if (item.code === yiZhuData.value.doseUnit) {
-              jiLiangValue.value = item.value
-            }
-          })
-        } else if (listNotBlank(yaoPinJiLiangData.value)) {
-          // 没有剂量单位的时候默认加载第一个计量单位 并且计算
-          yiZhuData.value.doseUnit = yaoPinJiLiangData.value[0].code
-          yiZhuData.value.dose = yaoPinJiLiangData.value[0].value
-          jiLiangValue.value = yaoPinJiLiangData.value[0].value
-        }
-        await jiSuanLingLiang(yiZhuData.value.dose)
-        // 加载默认频率 如果已经填写了 就用有的
-        if (stringIsBlank(row.frequCode)) {
-          // 如果药品中自带了 频率就用药品表的频率
-          if (stringNotBlank(res.data.frequCode)) {
-            yiZhuData.value.frequCode = res.data.frequCode
-            yiZhuData.value.frequCodeName = res.data.frequCodeName
-          } else {
-            if (queryParam.value.frequCode === frequCodeEnum.longTerm) {
-              yiZhuData.value.frequCode = frequencyConfig
-            } else if (queryParam.value.frequCode === frequCodeEnum.temporary) {
-              yiZhuData.value.frequCode = 'ONCE'
-            } else {
-              yiZhuData.value.frequCode = frequencyConfig
-            }
-          }
-        }
-        // 加载给药方式 如果已经有了就没事了
-        if (stringIsBlank(yiZhuData.value.supplyCode)) {
-          if (stringNotBlank(res.data.supplyCode)) {
-            yiZhuData.value.supplyCode = res.data.supplyCode
-            yiZhuData.value.supplyCodeName = res.data.supplyCodeName
-          }
-        }
-      }
-      openTheOrderPopUpWindow()
-    } catch (e) {
-      if (yiZhuData.value.statusFlag === '1') {
-        await Sleep(200);
-        setTheTemporaryVariableMedicalOrder()
-      }
-    }
-  } else {
-    yiZhuData.value.kjywFlag = 0
-    try {
-      let queryKey2 = feeKey(row.orderCode, '00', props.patientInfo.zkWard, queryParam.value.groupNo, yiZhuData.value.superiorDoctor, yiZhuData.value.statusFlag)
-      let res = await huoQuFeiYongXinXi(queryKey2)
-      tiShiBiaoTi.value = res.prompt
-      if (newData) {
-        openTheOrderPopUpWindow()
-        if (stringNotBlank(res.prompt)) {
-          tiShiBiaoTi.value = res.prompt
-        }
-        if (!row.dose) {
-          yiZhuData.value.dose = 1
-        }
-        // 如果是项目就不需要给药方式
-        yiZhuData.value.supplyCode = null
-        yiZhuData.value.supplyCodeName = ''
-      }
-    } catch (e) {
-      if (yiZhuData.value.statusFlag === '1') {
-        await Sleep(200)
-        setTheTemporaryVariableMedicalOrder()
-      }
-    }
-  }
-  if (newData) {
-    // 判断这个是不是 新添加的数据 如果是空的就是 新数据
-    const serverDate = await getServerDate();
-    if (!yiZhuData.value.orderTime) {
-      yiZhuData.value.orderTime = serverDate
-    }
-    if (!yiZhuData.value.startTime) {
-      yiZhuData.value.startTime = serverDate
-    }
-    // 用来加载默认的执行科室 加载项目的执行科室
-    if (laiyuan === 1) {
-      if (stringNotBlank(row.execDept)) {
-        yiZhuData.value.execUnit = row.execDept
-        yiZhuData.value.execUnitName = row.execDeptName
-        xcMessage.warning('请注意,已使用默认执行科室,如需修改请在执行科室下拉框中搜索科室。')
-      } else {
-        yiZhuData.value.execUnit = props.patientInfo.zkWard
-        yiZhuData.value.execUnitName = props.patientInfo.zkWardName
-      }
-    } else {
-      if (stringIsBlank(row.execUnit)) {
-        yiZhuData.value.execUnit = props.patientInfo.zkWard
-        yiZhuData.value.execUnitName = props.patientInfo.zkWardName
-      }
-    }
-
-    if (!yiZhuData.value.frequCode) {
-      yiZhuData.value.frequCode = 'ONCE'
-      yiZhuData.value.frequCodeName = '一次'
-    }
-    try {
-      pingLvRef.value.focus()
-    } catch (e) {
-      console.log(e)
-    }
-
-  }
-  if (queryParam.value.frequCode === 'takeMedicine') {
-    yiZhuData.value.selfBuy = '4'
-    yiZhuData.value.frequCode = 'ONCE'
-    yiZhuData.value.supplyCode = '007'
-  }
-  // 显示父医嘱的名称
-  if (yiZhuData.value.statusFlag !== '1' && yiZhuData.value.parentNo) {
-    fuYiZhuData.value = []
-    fuYiZhuData.value.push({
-      actOrderNo: yiZhuData.value.parentNo,
-      orderName: yiZhuData.value.parentNoName,
-    })
-  }
-  // 如果搜索了医嘱那么 这里就需要 重新赋值,不认表格就没办法变化了,把原来的换掉
-  for (let i = yzData.value.length - 1; i >= 0; i--) {
-    let item = yzData.value[i];
-    if (yiZhuData.value.actOrderNo === item.actOrderNo) {
-      yzData.value[i] = yiZhuData.value
-      return
-    }
-  }
-
-  if (laiyuan === 1) {
-    if (queryParam.value.frequCode === frequCodeEnum.temporary && yiZhuData.value.frequCode !== 'ONCE') {
-      yiZhuData.value.frequCode = 'ONCE'
-    } else if (queryParam.value.frequCode === frequCodeEnum.longTerm && yiZhuData.value.frequCode === 'ONCE') {
-      yiZhuData.value.frequCode = frequencyConfig
-    }
-  }
-}
 
 /* 频率 */
 const pingLvRef = ref()
@@ -793,10 +590,8 @@ const jiSuanLingLiang = async (val) => {
     return;
   }
   let drugQuanA = Math.ceil(Dig.division(val, jiLiangValue.value))
-  console.log('领量', drugQuanA, Dig.division(val, jiLiangValue.value))
   if (yiZhuData.value.serial === '99') {
     drugQuanA = Math.ceil(Dig.division(drugQuanA, yiZhuData.value.packSize))
-    console.log('大包装 %o ,除以%o,包装规格%o', drugQuanA, Dig.division(drugQuanA, yiZhuData.value.packSize), yiZhuData.value.packSize)
   }
   yiZhuData.value.drugQuan = drugQuanA;
 }
@@ -812,7 +607,7 @@ const xuanZheJiLiang = (val) => {
 // 医嘱限制时间不能在之前
 const disabledDate = (time) => {
   if (props.patientInfo?.admissDate) {
-    return time.getTime() < new Date(props.patientInfo?.admissDate).getTime() - 8.64e7;
+    return time.getTime() < new Date(props.patientInfo.admissDate).getTime() - 8.64e7;
   }
   return true;
 }
@@ -852,10 +647,8 @@ const modifyDosingMethod = (val) => {
   yiZhuData.value.orderTime = val.orderTime
   yiZhuData.value.startTime = val.startTime
   yiZhuData.value.endTime = val.endTime
-
   yiZhuData.value.supplyCode = '044'
   yiZhuData.value.supplyCodeName = '副药'
-
   yiZhuData.value.frequCode = val.frequCode
   yiZhuData.value.frequCodeName = val.frequCodeName
   yiZhuData.value.groupNo = val.groupNo
@@ -872,7 +665,7 @@ const clearDoctorSOrder = () => {
  */
 const setTheTemporaryVariableMedicalOrder = () => {
   qingKong()
-  baoCunXinXiRef.value.openOrClose(false);
+  errorMsg.value.dialog = false
   yiZhuData.value.actOrderNo = addTempOrderNo
   openSearch()
 }
@@ -889,7 +682,6 @@ const isEdit = computed(() => {
   return (stringIsBlank(yiZhuData.value.actOrderNo) || yiZhuData.value.statusFlag !== '1' || stringIsBlank(props.patientInfo.inpatientNo));
 })
 
-let baoCunXinXiRef = ref(null)
 /**
  * 保存, 录入状态的医嘱
  * @returns {Promise<boolean>}
@@ -916,13 +708,14 @@ const toAddAnOrder = async () => {
   try {
     let res = await enterOrders(param)
     if (res && res.error) {
-      baoCunXinXiRef.value.openOrClose()
-      errorMessageData.value = res.data
+      errorMsg.value.type = YzErrTypeEnum.确认错误
+      errorMsg.value.dialog = true
+      errorMsg.value.data = res.data
       return false
     }
     // 数据完全没问题
     if (res != null && res.code && res.code === 200) {
-      errorMessageData.value = {}
+      errorMsg.value.data = {}
       let orderNo = yiZhuData.value.actOrderNo
       await setOrderDataAndTwinkle(orderNo, res.data)
     }
@@ -957,7 +750,7 @@ const confirmOrdersClick = async () => {
     }
     let res = await confirmOrders(props.patientInfo)
     if (res !== null && res.error) {
-      baoCunXinXiRef.value.openOrClose()
+      errorMsg.value.dialog = false
       errorMessageData.value = res.data
     }
   } catch (e) {
@@ -1125,12 +918,10 @@ onMounted(() => {
   yzMitt.on('allowReplication', () => {
     return copyOrderNo.value.actOrderNo !== null
   })
-
   yzMitt.on('deleteAnOrderByOrderNo', ({actOrderNo, orderName}, clearOrNot = true) => {
     if (stringIsBlank(actOrderNo)) {
       BizException(ExceptionEnum.MESSAGE_ERROR, '请先选择要删除的医嘱')
     }
-
     CyMessageBox.confirm({
       message: `确认是否要删除<span style="color: red"> ${orderName} </span>`,
       dangerouslyUseHTMLString: true,
@@ -1170,14 +961,12 @@ onActivated(() => {
   })
 })
 
-
 defineExpose({
   fillData,
   toDeleteAnOrderClick,
   confirmOrdersClick,
   isEdit
 })
-
 </script>
 
 <style scoped lang="scss">

+ 1 - 1
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/yz-header/YzQueryCondition.vue

@@ -340,7 +340,7 @@ const confirmTheDoctorSOrderWithMedicineClick = () => {
   confirmLoading.value = true
   confirmTheDoctorSOrderWithMedicine(props.patientInfo.inpatientNo, props.patientInfo.admissTimes).then((res) => {
     if (res?.error) {
-      errorMsg.value.type = 3
+      errorMsg.value.type = YzErrTypeEnum.确认错误
       errorMsg.value.dialog = true
       errorMsg.value.data = res.data
     } else {

+ 2 - 2
src/main.js

@@ -19,7 +19,7 @@ import VElBtn from "@/directives/v-el-btn";
 import VTitle from "@/directives/v-title";
 import "driver.js/dist/driver.css";
 import DomZIndex from 'dom-zindex'
-import {addVxeTableFormats} from "@/utils/vxe-formatter";
+import initVxeConfig from "@/utils/vxe-formatter";
 
 DomZIndex.getNext = () => {
     return useZIndex().nextZIndex()
@@ -30,7 +30,7 @@ DomZIndex.getCurrent = () => {
 }
 
 addRoutes()
-addVxeTableFormats()
+initVxeConfig()
 
 export const app = createApp(App)
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {

+ 36 - 1
src/utils/vxe-formatter.ts

@@ -1,7 +1,7 @@
 import {VXETable} from 'vxe-table'
 import XEUtils from "xe-utils";
 
-export function addVxeTableFormats() {
+function addVxeTableFormats() {
     VXETable.formats.add('formatDate', {
         cellFormatMethod({cellValue}, format: string = 'yy-MM-dd HH:mm') {
             return XEUtils.toDateString(cellValue, format)
@@ -24,4 +24,39 @@ export function addVxeTableFormats() {
     })
 }
 
+export declare function addUnit(value: string | number, defaultUnit?: string): boolean;
 
+declare module 'xe-utils/ctor' {
+    interface XEUtilsMethods {
+        addUnit: typeof addUnit;
+    }
+}
+
+function addVxeUtils() {
+    XEUtils.mixin({
+        isStringNumber(val: string) {
+            if (!XEUtils.isString(val)) {
+                return false
+            }
+            return !Number.isNaN(Number(val));
+        },
+        addUnit(value: string | number, defaultUnit: string = 'px') {
+            if (!value)
+                return "";
+            if (XEUtils.isNumber(value) || XEUtils.isStringNumber(value)) {
+                return `${value}${defaultUnit}`;
+            } else if (XEUtils.isString(value)) {
+                return value;
+            }
+        }
+    })
+
+}
+
+
+function initVxeConfig() {
+    addVxeTableFormats()
+    addVxeUtils()
+}
+
+export default initVxeConfig

+ 40 - 37
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.ts

@@ -1,19 +1,19 @@
-import {stringIsBlank, stringNotBlank} from "../../../../utils/blank-utils";
+import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
 import {ElMessage} from "element-plus";
-import {getPatientInfo, getDrgPatInfo} from "../../../../api/inpatient/patient";
-import {BizException, ExceptionEnum} from "../../../../utils/BizException";
+import {getPatientInfo, getDrgPatInfo} from "@/api/inpatient/patient";
+import {BizException, ExceptionEnum} from "@/utils/BizException";
 import {nextTick, Ref, ref, computed, onActivated, onDeactivated} from "vue";
-import {getServerDateApi} from "../../../../api/public-api";
-import {getFormatDatetime} from "../../../../utils/date";
-import {isDev} from "../../../../utils/public";
-import {getFrequency, getSupplyType, huoQuYiZhuShuJu} from "../../../../api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
-import EventBus from "../../../../utils/mitt";
+import {getServerDateApi} from "@/api/public-api";
+import {getFormatDatetime} from "@/utils/date";
+import {isDev} from "@/utils/public";
+import {getFrequency, getSupplyType, huoQuYiZhuShuJu} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
+import EventBus from "@/utils/mitt";
 import XEUtils from 'xe-utils'
-import {getAncillaryInformation} from '../../../../api/zhu-yuan-yi-sheng/jian-yan-jian-cha-shen-qing'
-import {timeLimitPromptByPatientNo} from "../../../../api/emr-control/emr-time-limit-prompt";
+import {getAncillaryInformation} from '@/api/zhu-yuan-yi-sheng/jian-yan-jian-cha-shen-qing'
+import {timeLimitPromptByPatientNo} from "@/api/emr-control/emr-time-limit-prompt";
 
 export interface PatInfo {
-    inpatientNo?: string
+    inpatientNo?: string | null
     admissTimes?: number,
     ledgerSn?: number
     admissDate?: string
@@ -33,7 +33,7 @@ export interface PatInfo {
 }
 
 // 患者信息
-export const huanZheXinXi = ref<PatInfo>({
+export const huanZheXinXi: Ref<PatInfo> = ref({
     zkWardName: "",
     zkWard: "",
     consultPhysician: "",
@@ -98,7 +98,7 @@ export function youWuXuanZheHuanZhe() {
     return false
 }
 
-export function getSelfBuy(val) {
+export function getSelfBuy(val: string) {
     if (stringIsBlank(val)) return ""
     switch (val) {
         case '1':
@@ -168,7 +168,7 @@ export interface YzType {
     drugWeightUnitName?: any;
     statusFlag: string;
     statusTime?: any;
-    selfBuy: string;
+    selfBuy: string | null;
     dose?: any;
     doseUnit?: any;
     doseUnitName?: any;
@@ -453,7 +453,7 @@ export const jsQueryYzData = async () => {
 }
 
 let newDate = ''
-getServerDateApi().then(res => {
+getServerDateApi().then((res: string) => {
     newDate = res
 })
 
@@ -506,10 +506,12 @@ export function yzDataToTree(data: YzType[]): YzType[] {
         let key: number = item.actOrderNo;
         if (tempMap.has(item.parentNo)) {
             noParent.delete(key);
-            let parent = tempMap.get(item.parentNo);
-            parent.orderGroup = "┌";
-            parent.children = parent.children || [];
-            parent.children.push(item);
+            const parent = tempMap.get(item.parentNo);
+            if (parent) {
+                parent.orderGroup = "┌";
+                parent.children = parent.children || [];
+                parent.children.push(item);
+            }
             item.orderGroup = "丨";
         }
     });
@@ -540,7 +542,7 @@ export function yzDataToTree(data: YzType[]): YzType[] {
     return list
 }
 
-export const setOrderDataAndTwinkle = async (order, data: YzType[]) => {
+export const setOrderDataAndTwinkle = async (order: number, data: YzType[]) => {
     let temp = data;
     let tempMap = new Map();
 
@@ -653,23 +655,23 @@ export const tempYzData = computed<YzType[]>(() => {
 })
 
 // 获取医嘱的下标
-export const getYzIndex = (key: string) => {
-    let temp = tempYzData.value.findIndex(item => {
+export const getYzIndex = (key: string | number) => {
+    return XEUtils.findLastIndexOf(tempYzData.value, (item => {
         return item.id == key
-    })
-    if (typeof temp === 'undefined') {
-        return '没有找到序号'
-    } else {
-        return temp
-    }
+    }))
 }
 
 interface yZErrorType {
     dialog: boolean
-    type: number
+    type: YzErrTypeEnum
     data: any
 }
 
+export enum YzErrTypeEnum {
+    确认错误,
+    删除错误
+}
+
 // 错误信息
 export const errorMsg: Ref<yZErrorType> = ref({
     dialog: false,
@@ -723,7 +725,7 @@ const strDefaultExtraInformation = JSON.stringify(defaultExtraInformation)
 
 
 export function clickTimeLimitReminder() {
-    timeLimitPromptByPatientNo(huanZheXinXi.value.inpatientNo).then(res => {
+    timeLimitPromptByPatientNo(<string>huanZheXinXi.value!.inpatientNo).then(res => {
         yzMitt.emit('setTimeLimitPrompt', res)
     })
 }
@@ -738,7 +740,7 @@ export const clickOnThePatient = async (patNo: string) => {
     changePatientHook.forEach(item => {
         item()
     })
-    getDrgPatInfo(huanZheXinXi.value).then(res => {
+    getDrgPatInfo(huanZheXinXi.value).then((res: { [x: string]: string | undefined; } | null) => {
         if (res != null) {
             huanZheXinXi.value.groupInfoName = res['name']
             huanZheXinXi.value.groupInfoWeight = res['weight']
@@ -840,7 +842,6 @@ export const drugManual = ref({
     }
 })
 
-
 export let tableHeader = [
     {label: '编码', prop: 'orderCode'},
     {label: '包装', prop: 'serial'},
@@ -882,12 +883,14 @@ export const jyJcRestriction = (data: AddJcParams, error: boolean = true) => {
             return false
         }
 
-        if (data.minAgeRestriction && data.minAgeRestriction >= huanZheXinXi.value.age) {
+        // @ts-ignore
+        if (data.minAgeRestriction && data.minAgeRestriction >= huanZheXinXi.value!.age) {
             error && BizException(ExceptionEnum.MESSAGE_ERROR, "项目最小年龄限制" + data.minAgeRestriction + "岁,患者年龄不符合。")
             return false
         }
 
-        if (data.maxAgeRestriction && data.maxAgeRestriction <= huanZheXinXi.value.age) {
+        // @ts-ignore
+        if (data.maxAgeRestriction && data.maxAgeRestriction <= huanZheXinXi.value!.age) {
             error && BizException(ExceptionEnum.MESSAGE_ERROR, "项目最大年龄限制" + data.maxAgeRestriction + "岁,患者年龄不符合。")
             return false
         }
@@ -897,6 +900,7 @@ export const jyJcRestriction = (data: AddJcParams, error: boolean = true) => {
 
 export const addJcCheck = async (data: AddJcParams) => {
     let temp = addCheckList.value.findIndex(item => {
+        // @ts-ignore
         return item.orderCode === data.orderCode
     })
     if (temp > -1) {
@@ -904,13 +908,11 @@ export const addJcCheck = async (data: AddJcParams) => {
     }
     jyJcRestriction(data)
     data.startTime = await getServerDateApi();
+    // @ts-ignore
     addCheckList.value.push(data)
 }
 
 export interface YzMitt {
-    openDoctorAuthoriztion: (drugCode: string) => Promise<{
-        code: string
-    }>,
     jySave: () => void,
     jySaveTemplate: () => void
     upperDoctorSetting: (data: any) => void
@@ -1001,6 +1003,7 @@ const changePatientHook = new Map();
 let changePatientHookLength = 0;
 
 export function onChangePatient(cb: () => void) {
+    // @ts-ignore
     new ChangePatient(changePatientHookLength++, cb)
 }
 

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

@@ -44,24 +44,23 @@
 </template>
 
 <script setup lang="ts">
+import {deleteMultipleOrders, insertTemplateOrder,} from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
 import {
-  deleteMultipleOrders,
-  insertTemplateOrder,
-} from '@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru'
-import {
-  huanZheXinXi,
-  getYzIndex,
-  zkList,
-  queryParam,
+  associateOrders,
   clickOnThePatient,
+  confirmLoading,
   drugManual,
-  associateOrders,
+  errorMsg,
+  getYzIndex,
+  huanZheXinXi,
+  queryParam,
+  setYzOrderGroup,
   youWuXuanZheHuanZhe,
   yzData,
-  errorMsg,
+  YzErrTypeEnum,
   yzMitt,
-  confirmLoading,
-  setYzOrderGroup, YzType
+  YzType,
+  zkList
 } from '../public-js/zhu-yuan-yi-sheng'
 import {stringIsBlank, stringNotBlank} from '@/utils/blank-utils'
 import {getTheTransferList} from '@/api/public-api'
@@ -80,7 +79,7 @@ import YzTableV2 from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/table/YzTable
 import FeeTable from "@/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/FeeTable.vue";
 import {applicationForRevocation} from "@/api/zhu-yuan-yi-sheng/qrder-quash";
 import XEUtils from 'xe-utils'
-import {ref, onMounted, onActivated, nextTick} from 'vue'
+import {nextTick, onActivated, onMounted, ref} from 'vue'
 import {CyMessageBox} from "@/components/cy/message-box";
 import DoctorSOrderFee from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/DoctorSOrderFee.vue";
 
@@ -344,7 +343,7 @@ const batchDeleteOrdersClick = () => {
           })
         }
         errorMsg.value.dialog = true
-        errorMsg.value.type = 2
+        errorMsg.value.type = YzErrTypeEnum.删除错误
         errorMsg.value.data = errData
       } else {
         yzMitt.emit('queryYz', false)

+ 27 - 46
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/DoctorAuthorization.vue

@@ -1,19 +1,17 @@
-<script setup name='DoctorAuthorization'>
+<script setup lang="ts">
 // 医生开医嘱可能有些没有权限通过这种登录方式进行授权
-import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue";
 import {doctorAuthorizationLogin} from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
-import {yzMitt} from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 import {xcMessage} from "@/utils/xiaochan-element-plus";
+import {ClosingMethod, dialogEmits} from "@/components/js-dialog-comp/useDialogToJs";
+
+
+const props = defineProps<{
+  drugCode: string
+}>()
+const emits = defineEmits(dialogEmits)
 
-const dialog = ref(false)
-const cancel = (flag = true) => {
-  dialog.value = false
-  if (flag) {
-    cancelReject();
-  }
-  clear()
-}
 
+const dialog = ref(true)
 const param = ref({
   codeRs: '',
   code: '',
@@ -22,47 +20,27 @@ const param = ref({
   drugCode: ''
 })
 
+const cancel = () => {
+  dialog.value = false
+  emits('closed', ClosingMethod.CANCEL)
+}
+
 const confirm = () => {
+  param.value.drugCode = props.drugCode
   doctorAuthorizationLogin(param.value).then((res) => {
+    dialog.value = false
     xcMessage.success('授权成功。')
-    next(res)
-    cancel(false)
+    emits('closed', ClosingMethod.CONFIRM, res)
   })
 }
-
-const clear = () => {
-  param.value = {
-    codeRs: '',
-    code: '',
-    password: '',
-    name: '',
-    drugCode: ''
-  }
-}
-
-let next = null
-let cancelReject = null
-
-onMounted(() => {
-  yzMitt.on('openDoctorAuthoriztion', (drugCode) => {
-    param.value.drugCode = drugCode
-    dialog.value = true
-    return new Promise((resolve, reject) => {
-      next = resolve
-      cancelReject = reject
-    })
-  })
-})
-
 </script>
 
 <template>
-  <xc-dialog-v2 v-model="dialog"
-                title="医生授权"
-                show-button
-                @closed="cancel"
-                @confirm="confirm"
-                @cancel="cancel">
+  <el-dialog v-model="dialog"
+             :close-on-click-modal="false"
+             :close-on-press-escape="false"
+             :show-close="false"
+             title="医生授权">
     <el-alert type="warning">
       药品分为限制等级,可通过上级医生授权的方式开出大于自身等级的药品,输入上级医生的工号和密码后,点击确认即可,请注意电子确认后该医嘱会变成这个医生开的,请不要在此医嘱上进行修改不然这条医嘱会变成另外一个医生的,如果开错了,删除重新开。。
     </el-alert>
@@ -76,8 +54,11 @@ onMounted(() => {
         <el-input v-model="param.password" class="security"/>
       </el-form-item>
     </el-form>
-  </xc-dialog-v2>
-
+    <template #footer>
+      <el-button @click="cancel">取消</el-button>
+      <el-button @click="confirm">确认</el-button>
+    </template>
+  </el-dialog>
 </template>
 
 <style scoped lang="scss">