import { Get } from "./method";

// 获取扫码注册参数
export function getSceneRegisterMethod(scene: string) {
  const params = { scene: decodeURIComponent(scene) };
  const transform = ({ data }: AnyObject) => {
    const { cardno, phone, patientId } = data;
    return { cardno, phone, patientId, visible: !patientId }
  }
  return Get(`/patientInfoManage/getCardnoPhoneMantissaByScene`, { params, transform }).catch(() => ({ visible: false }));
}

// 扫码注册
export function setSceneRegisterMethod(params: { scene: string; phone: string; cardno?: string }) {
  const transform = ({ data }: AnyObject) => {
    return { patientId: data }
  }
  return Get(`/patientInfoManage/scanAuth`, { params, transform })
}