yxh
yxh
7 天以前 09dc74e264b6262cbe41c9c8476e24705871d4a6
src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -14,19 +14,19 @@
    >
      <!-- ===== 编辑区(需要录入的字段)===== -->
      <el-row :gutter="20">
        <el-col :span="6">
        <el-col :xs="24" :sm="12" :md="12" :lg="6">
          <el-form-item label="检查项目" prop="">
            {{getCheckTypeName(formData.checkType)}}
          </el-form-item>
        </el-col>
        <el-col :span="12">
        <el-col :xs="24" :sm="24" :md="12" :lg="12">
          <el-form-item label="患者编号" prop="patId">
            <el-input v-model="formData.patId" placeholder="请输入患者编号" @input="getRentInfoByPatId" />
            <Barcode v-if="displayBarCode" :value="displayBarCode" :width=100 />
            <el-button @click="copyBarcode()">复制</el-button>
            <Barcode v-if="showBarCode" :value="barcodeContent" :width=100 />
            <el-button v-if="showCopyButton" :disabled="!barcodeContent" @click="copyBarcode()">复制</el-button>
          </el-form-item>
        </el-col>
        <el-col :span="6">
        <el-col :xs="24" :sm="12" :md="12" :lg="6">
          <el-form-item label="设备编号" prop="devId">
            <el-input v-model="formData.devId" placeholder="请输入设备编号" @input="getDevInfo"/>
          </el-form-item>
@@ -258,7 +258,6 @@
  state: undefined,
})
const displayBarCode = ref<string> ()
const getRentInfoByPatId = () => {
  const tempPatId = formData.value.patId;
@@ -268,7 +267,6 @@
  formData.value.patId = tempPatId;
  getFreeRentInfo(formData.value)
  copyBarcode()
}
// 根据患者或设备, 获取 Free的租赁
@@ -437,7 +435,6 @@
    formData.value.doctorAdviceNo = queueVO?.doctorAdviceNo
  formData.value.patIdentityId = queueVO?.patIdentityId
  getFreeRentInfo(formData.value)  // 待检查的信息  @ dev_rent 表
  copyBarcode()
}
defineExpose({ setPatient, getList: () => getList() }) // 提供 setPatient 方法,用于设置患者
@@ -642,51 +639,45 @@
/**
 * 获取条形码,显示与否  同一个值
 */
const getDisplayBarcode = (): string => {
  if (formData.value.checkType == null)
    return ""
/**
 * 【本需求】患者条码口径(门诊/急诊/体检 = 就诊流水号;住院不出条码,只留「复制」)
 *
 *  · 门诊(1) / 急诊(2) / 体检(4) → 条码内容 = **就诊流水号**(episodeId)
 *  · 住院(3)                    → **不显示条码**,只保留「复制」按钮(复制内容同样是就诊流水号)
 *  · 「复制」按钮与条码一致:同受「检查类型 → 患者条码显示」配置控制
 *    (该检查类型未勾选这个患者来源时,条码和复制按钮都不显示)
 */
const patSourceValue = computed<number | null>(() => {
  const source = formData.value.patDetails?.source ?? formData.value.patSrc
  return source === null || source === undefined || source === '' ? null : Number(source)
})
  // 【本次修复】「患者条码显示」未配置(null/空)→ 不显示(按现场确认口径)
/** 是否通过了「患者条码显示」配置(勾选了当前患者来源) */
const barcodeEnabled = computed<boolean>(() => {
  if (formData.value.checkType == null) return false
  const displayBarcode: number[] | undefined = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType)
  if (displayBarcode == null || displayBarcode.length === 0)
    return ""
  if (displayBarcode == null || displayBarcode.length === 0) return false
  const patSource = patSourceValue.value
  if (patSource == null) return false
  return displayBarcode.map(Number).includes(patSource)
})
  // 【本次修复】来源优先取 patDetails.source,缺失时回退到平铺的 patSrc
  const patSource = formData.value.patDetails?.source ?? formData.value.patSrc
  if (patSource == null)
    return ""
/** 条码 / 复制的内容:统一取「就诊流水号」 */
const barcodeContent = computed<string>(() =>
  barcodeEnabled.value ? (formData.value.episodeId ?? '') : ''
)
  if (!displayBarcode.map(Number).includes(Number(patSource)))
    return ""
/** 是否显示条码:住院(来源 3)不显示;内容为空时也不显示 */
const showBarCode = computed<boolean>(
  () => barcodeEnabled.value && patSourceValue.value !== 3 && barcodeContent.value !== ''
)
  return getBarcode()
}
const getBarcode = (): string => {
  if (formData.value.checkType == null)
    return ""
  const patSource = formData.value.patDetails?.source ?? formData.value.patSrc
  if (patSource == null)
    return ""
  // 门诊/急诊 → 申请单号;住院/体检 → 就诊流水号
  if (1 === Number(patSource) || 2 === Number(patSource))
    return formData.value.applyNo??""
  else if (3 === Number(patSource) || 4 === Number(patSource))
    return formData.value.episodeId??""
  return ""
}
/** 是否显示「复制」按钮:与条码一致(同受配置控制) */
const showCopyButton = computed<boolean>(() => barcodeEnabled.value)
const copyBarcode = async () => {
  displayBarCode.value = getDisplayBarcode()
  const barCode = getBarcode()
  if (isStringEmpty(barCode))
    return
  await navigator.clipboard.writeText( barCode );
  if (!barcodeContent.value) return
  await navigator.clipboard.writeText(barcodeContent.value)
}
/** 初始化 **/