/**
 * 就诊人档案 API（跨医生视角，供药师审方等场景）
 */
import { requestClient } from '#/api/request';

const prefix = 'user-patient-profile/';

/** 用户管理列表（微信用户 + 就诊人，旧接口） */
export async function getUserPatientProfileListApi(params?: {
  page?: number;
  pageSize?: number;
  keyword?: string;
}) {
  return requestClient.get<any>(`${prefix}list`, { params });
}

/** 会员管理：微信用户分页 */
export async function getWxUserListApi(params?: {
  page?: number;
  pageSize?: number;
  keyword?: string;
}) {
  return requestClient.get<any>(`${prefix}user-list`, { params });
}

/** 某微信用户下的就诊人列表 */
export async function getPatientListByUserApi(userId: number) {
  return requestClient.get<any>(`${prefix}patient-list-by-user`, {
    params: { user_id: userId },
  });
}

/** 小程序用户 + 就诊人基础信息 */
export async function getUserPatientProfileDetailApi(upId: number) {
  return requestClient.get<any>(`${prefix}detail`, {
    params: { up_id: upId },
  });
}

/** 就诊人挂号记录 */
export async function getUserPatientRegisterListApi(
  upId: number,
  params?: { page?: number; pageSize?: number },
) {
  return requestClient.get<any>(`${prefix}register-list`, {
    params: { up_id: upId, ...params },
  });
}

/** 就诊人处方记录 */
export async function getUserPatientPrescriptionListApi(
  upId: number,
  params?: { page?: number; pageSize?: number },
) {
  return requestClient.get<any>(`${prefix}prescription-list`, {
    params: { up_id: upId, ...params },
  });
}

/** 就诊人商品订单记录 */
export async function getUserPatientOrderListApi(
  upId: number,
  params?: { page?: number; pageSize?: number },
) {
  return requestClient.get<any>(`${prefix}order-list`, {
    params: { up_id: upId, ...params },
  });
}
