yxh
2026-10-18 01ee694a3bb8048372fc793a8de314d70b688b35
src/store/modules/checkType.ts
@@ -8,15 +8,21 @@
export interface CheckTypeSimpleVO {
  value: number
  name: string
  displayBarcode: []
  notes: string
  seqPrefix: string // 序号前缀
  expenseRecognition: number
  /** 是否需要设备领用:0-不需要,1-需要(用于「设备领用」页的校验) */
  needDevReady?: number
}
export interface CheckTypeState {
  checkTypeMap: Map<number, string>
  checkTypeMap: Map<number, CheckTypeSimpleVO>
  isSetCheckType: boolean
}
export const useCheckTypeStore = defineStore('checktype ', {
  state: (): CheckTypeState => ({
    checkTypeMap: new Map<number, string>(),
    checkTypeMap: new Map<number, CheckTypeSimpleVO>(),
    isSetCheckType: false
  }),
  getters: {
@@ -40,12 +46,12 @@
      } else {
        const res = await CheckTypeApi.getSimpleCheckTypeList()
        // 设置数据
        const checkTypeMap = new Map<number, string>()
        const checkTypeMap = new Map<number, CheckTypeSimpleVO>()
        res.forEach((simpleVO: CheckTypeSimpleVO) => {
          // 获得 dictType 层级
          const enumValueObj = checkTypeMap[simpleVO.value]
          if (!enumValueObj) {
            checkTypeMap[simpleVO.value] = simpleVO.name
            checkTypeMap[simpleVO.value] = simpleVO
          }
        })
        this.checkTypeMap = checkTypeMap
@@ -57,7 +63,7 @@
      if (!this.isSetCheckType) {
        this.setCheckTypeMap()
      }
      return this.checkTypeMap[type]
      return this.checkTypeMap[type]?.name
    },
    getCheckTypeOptions() {
      if (!this.isSetCheckType) {
@@ -66,20 +72,57 @@
      return Object.keys(this.checkTypeMap).map((key) => {
        return {
          value: parseInt(key, 10),
          label: this.checkTypeMap[key]
          label: this.checkTypeMap[key].name
        }
      });
    },
    getCheckTypeDispBarCode(type: number) {
      if (!this.isSetCheckType) {
        this.setCheckTypeMap()
      }
      return this.checkTypeMap[type]?.displayBarcode
    },
    getCheckTypeNotes(type: number) {
      if (!this.isSetCheckType) {
        this.setCheckTypeMap()
      }
      return this.checkTypeMap[type].notes
    },
    getCheckTypeSeqPrefix(type: number) {
      if (!this.isSetCheckType) {
        this.setCheckTypeMap()
      }
      return this.checkTypeMap[type]?.seqPrefix || ''
    },
    getExpenseRecognition(type: number) {
      if (!this.isSetCheckType) {
        this.setCheckTypeMap()
      }
      return this.checkTypeMap[type]?.expenseRecognition
    },
    /**
     * 该检查项目是否需要「设备领用」。
     *
     * 用于「设备领用」页的守卫:只有需要设备领用的项目(如动态心电、动态血压)
     * 才应进入领用流程;常规心电图等不需要领用的项目若被拉到该页,应拦下并提示,
     * 否则会出现"检查类患者出现在设备领用模块"的混乱。
     */
    getNeedDevReady(type: number) {
      if (!this.isSetCheckType) {
        this.setCheckTypeMap()
      }
      return this.checkTypeMap[type]?.needDevReady
    },
    async resetCheckTypeInfo() {
      wsCache.delete(CACHE_KEY.CHECKTYPE_CACHE)
      const res = await CheckTypeApi.getSimpleCheckTypeList()
      // 设置数据
      const checkTypeMap = new Map<number, string>()
      const checkTypeMap = new Map<number, CheckTypeSimpleVO>()
      res.forEach((simpleVO: CheckTypeSimpleVO) => {
        // 获得 dictType 层级
        const enumValueObj = checkTypeMap[simpleVO.value]
        if (!enumValueObj) {
          checkTypeMap[simpleVO.value] = simpleVO.name
          checkTypeMap[simpleVO.value] = simpleVO
        }
      })
      this.checkTypeMap = checkTypeMap