import { UploadFileParams } from '#/axios';
import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';
import { useGlobSetting } from '/@/hooks/setting';
const globSetting = useGlobSetting();

export enum Api {
  archivesPatientBasicQueryPage = '/archives/patientBasic/query/page',
  archivesPatientBasicDetail = '/archives/patientBasic/detail',
  archivesPatientBasicAdd = '/archives/patientBasic/add',
  archivesPatientBasicEdit = '/archives/patientBasic/edit',
  archivesPatientBasicRemove = '/archives/patientBasic/removeByIds',
  archivesPatientBasicStats = '/archives/patientBasic/stats',
  archivesPatientBasicImportBatch = '/archives/patientBasic/import/batch',
  archivesPatientBasicExport = '/archives/patientBasic/export',
}

/**
 * @author fan
 * @description 病人类型数量统计
 * @returns
 */
export const archivesPatientBasicStats = () => {
  return defHttp.post({ url: Api.archivesPatientBasicStats });
};
/**
 *
 * @author lf
 * @date  2023/06/17 10:40
 * @description: 根据条件查询基础病历列表,权限 - archives:patientBasic:query
 * @method: POST
 * @param:
 *       {String}  name     患者姓名
 *       {String}  gender     性别
 * @return:
 *       {String}  scheduledId  排床id
 *       {String}  accessId  血管通路id
 *       {String}  uniqueNo  病人唯一编号
 *       {String}  name  患者姓名
 *       {String}  gender  性别
 *       {String}  cardNo  证件号码
 *       {Date}  birthday  出生日期
 *       {Integer}  height  身高
 *       {String}  address  详细地址
 *       {String}  moblie  联系电话
 *       {String}  type  类型
 *       {String}  bloodType  血型
 *       {String}  infectiousDiseases  传染病
 *       {String}  familyName  家属姓名
 *       {String}  familyMoblie  家属电话
 *       {String}  creatorName  creator_name
 *       {String}  updatorName  updator_name
 */

export const archivesPatientBasicQueryPage = (params?: object) => {
  return defHttp.post({ url: Api.archivesPatientBasicQueryPage, params: setParams(params) });
};
/**
 *
 * @author lf
 * @date  2023/06/17 10:40
 * @description: 根据id查询基础病历详细信息,权限 - archives:patientBasic:query
 * @method: GET
 * @param:  id 基础病历主键id
 * @return:
 *       {String}  scheduledId  排床id
 *       {String}  accessId  血管通路id
 *       {String}  uniqueNo  病人唯一编号
 *       {String}  name  患者姓名
 *       {String}  gender  性别
 *       {String}  cardNo  证件号码
 *       {Date}  birthday  出生日期
 *       {Integer}  height  身高
 *       {String}  address  详细地址
 *       {String}  moblie  联系电话
 *       {String}  type  类型
 *       {String}  bloodType  血型
 *       {String}  infectiousDiseases  传染病
 *       {String}  familyName  家属姓名
 *       {String}  familyMoblie  家属电话
 *       {String}  creatorName  creator_name
 *       {String}  updatorName  updator_name
 */
export const archivesPatientBasicDetail = (id: string) => {
  return defHttp.get({ url: Api.archivesPatientBasicDetail + '/' + id });
};

/**
 *
 * @author lf
 * @date  2023/06/17 10:40
 * @description: 添加基础病历,权限 - archives:patientBasic:add
 * @method: POST
 * @param:
 *       {String}  scheduledId  排床id
 *       {String}  accessId  血管通路id
 *       {String}  uniqueNo  病人唯一编号
 *       {String}  name  患者姓名
 *       {String}  gender  性别
 *       {String}  cardNo  证件号码
 *       {Date}  birthday  出生日期
 *       {Integer}  height  身高
 *       {String}  address  详细地址
 *       {String}  moblie  联系电话
 *       {String}  type  类型
 *       {String}  bloodType  血型
 *       {String}  infectiousDiseases  传染病
 *       {String}  familyName  家属姓名
 *       {String}  familyMoblie  家属电话
 *       {String}  creatorName  creator_name
 *       {String}  updatorName  updator_name
 * @return:
 *       0 添加失败
 *       1 添加成功
 */
export const archivesPatientBasicAdd = (params?: object) => {
  return defHttp.post({ url: Api.archivesPatientBasicAdd, params: params });
};

/**
 *
 * @author lf
 * @date  2023/06/17 10:40
 * @description: 通过主键id编辑基础病历,权限 - archives:patientBasic:edit
 * @method: POST
 * @param:
 *       {String}  scheduledId  排床id
 *       {String}  accessId  血管通路id
 *       {String}  uniqueNo  病人唯一编号
 *       {String}  name  患者姓名
 *       {String}  gender  性别
 *       {String}  cardNo  证件号码
 *       {Date}  birthday  出生日期
 *       {Integer}  height  身高
 *       {String}  address  详细地址
 *       {String}  moblie  联系电话
 *       {String}  type  类型
 *       {String}  bloodType  血型
 *       {String}  infectiousDiseases  传染病
 *       {String}  familyName  家属姓名
 *       {String}  familyMoblie  家属电话
 *       {String}  creatorName  creator_name
 *       {String}  updatorName  updator_name
 * @return:
 *       0 编辑失败
 *       1 编辑成功
 */
export const archivesPatientBasicEdit = (params?: object) => {
  return defHttp.post({ url: Api.archivesPatientBasicEdit, params: params });
};

/**
 * @description: 删除,权限 - archives:patientBasic:remove
 * @method: POST
 */
export const archivesPatientBasicRemove = (params: Array<string | number>) => {
  return defHttp.post({ url: Api.archivesPatientBasicRemove, params: params });
};

/**
 * @description: 批量导入,权限 - archives:patientBasic:import
 * @method: POST
 */
export function archivesPatientBasicImportBatch(
  params: UploadFileParams,
  onUploadProgress: (progressEvent: any) => void,
) {
  return defHttp.uploadFile(
    {
      url: globSetting.apiUrl + Api.archivesPatientBasicImportBatch,
      onUploadProgress,
    },
    params,
  );
}

/**
 * @description: 导出,权限 - archives:patientBasic:export
 * @method: POST
 */
export const archivesPatientBasicExport = (params: Array<string | number>) => {
  return defHttp.post({ url: Api.archivesPatientBasicExport, params: params });
};
