yxh
yxh
7 天以前 09dc74e264b6262cbe41c9c8476e24705871d4a6
src/api/ecg/appointment/index.ts
@@ -26,6 +26,11 @@
  bookCheckType: number // 预约检查项目
  paid: number //已付款
  bookSeqNum: number
  /**
   * 【本需求】非当天预约签到的"已确认"标记。
   * 前端弹窗确认后置 true 传给后端:后端据此放行非当天预约,并按**预留号**取号。
   */
  forceCheckIn?: boolean
  // ========== 以下字段后端 AppointmentRespVO 一直有返回,此前 TS 未声明 ==========
  // 需求1 使用:状态 / 开单医师 / 开单日期 / 距今天数(由 doctorTime 计算)/ 就诊卡号
  status?: string // 状态(字典 ecg_status)
@@ -44,11 +49,26 @@
  createTime?: Date | number | string // 创建时间
}
/**
 * 【本需求】预约记录页的「预约日期」用日期范围选择器,前端字段是 `bookDateRange`(['2026-11-01','2026-11-30']),
 * 而后端接收的是 `bookDateStart` / `bookDateEnd`(含首尾两天)。
 * 这里统一转换,避免每个调用点各写一遍:分页、导出都走它。
 */
const withBookDateRange = (params: any) => {
  if (!params) return params
  const { bookDateRange, ...rest } = params
  if (Array.isArray(bookDateRange) && bookDateRange.length === 2 && bookDateRange[0] && bookDateRange[1]) {
    rest.bookDateStart = `${bookDateRange[0]} 00:00:00`
    rest.bookDateEnd = `${bookDateRange[1]} 23:59:59`
  }
  return rest
}
// 预约 API
export const AppointmentApi = {
  // 查询预约分页
  getAppointmentPage: async (params: any) => {
    return await request.get({ url: `/ecg/appointment/page`, params })
    return await request.get({ url: `/ecg/appointment/page`, params: withBookDateRange(params) })
  },
  // 查询预约详情
@@ -69,6 +89,20 @@
  // 从HIS查询预约或开单信息
  queryAppointmentFromHis: async (patId: string) => {
    return await request.get({ url: `/ecg/appointment/query-his-by-patient?patId=` + patId })
  },
  /**
   * 【本需求:紧急患者不排队直接检查】按「申请单号 / 就诊号 / 患者编号」查近一个月(±30 天)的预约记录。
   * 结果按预约时间倒序;`checkTypes` 为本窗口开展的检查项目(逗号分隔,空则不限)。
   */
  getEmergencyCandidates: async (code: string, checkTypes?: number[]) => {
    const types = Array.isArray(checkTypes) && checkTypes.length > 0 ? checkTypes.join(',') : ''
    return await request.get({
      url:
        `/ecg/appointment/emergency-candidates?code=` +
        encodeURIComponent(code) +
        (types ? `&checkTypes=${types}` : '')
    })
  },
  // 新增预约
@@ -92,7 +126,7 @@
  // 导出预约 Excel
  exportAppointment: async (params) => {
    return await request.download({ url: `/ecg/appointment/export-excel`, params })
    return await request.download({ url: `/ecg/appointment/export-excel`, params: withBookDateRange(params) })
  },
  // 预约确认