import request from '@/utils/request'
/** =========================user=======================**/
export function getUserList(param) {
  return request({
    url: '/user/getUserList',
    method: 'post',
    data: param
  })
}
export function getUserByEmail(params) {
  return request({
    url: '/User/getUserByEmail',
    method: 'get',
    params
  })
}
export function getUserTypeList() {
  return request({
    url: `/UserTypeRole/getUserTypeList/0`,
    method: 'get'
  })
}

export function updateUserState(userId, state) {
  return request({
    url: `/user/updateUserState/${userId}/${state}`,
    method: 'post'
  })
}

export function getInstitutionList(typeId) {
  return request({
    url: `/institution/getInstitutionList/${typeId}`,
    method: 'get'
  })
}

export function addUser(param, confirm = false) {
  return request({
    url: `/user/addUser`,
    method: 'post',
    data: param,
    confirm
  })
}

export function updateUser(param) {
  return request({
    url: `/user/updateUser`,
    method: 'put',
    data: param
  })
}

export function getUser(params) {
  return request({
    url: `/user/getUser`,
    method: 'get',
    params
  })
}

export function deleteSysUser(userId) {
  return request({
    url: `/user/deleteUser/${userId}`,
    method: 'delete'
  })
}

export function getRoleList(userId, pageIndex, pageSize) {
  return request({
    url: `/role/getRoleList/${userId}/${pageIndex}/${pageSize}`,
    method: 'get'
  })
}

export function getUserRoles(userId) {
  return request({
    url: `/user/getUserRoles/${userId}`,
    method: 'get'
  })
}

export function UpdateUserRole(param) {
  return request({
    url: `/role/UpdateUserRole`,
    method: 'post',
    data: param
  })
}

export function resetPassword(userId) {
  return request({
    url: `/user/resetPassword/${userId}`,
    method: 'get'
  })
}

export function modifyPassword(param) {
  return request({
    url: `/user/modifyPassword`,
    method: 'post',
    data: param
  })
}

/** =========================role=======================**/
export function getRolesList(pageIndex, pageSize) {
  return request({
    url: `/role/getRoleList/${pageIndex}/${pageSize}`,
    method: 'get'
  })
}

export function addOrUpdateRole(param) {
  return request({
    url: `/role/addOrUpdateRole`,
    method: 'post',
    data: param
  })
}

export function deleteRole(roleId) {
  return request({
    url: `/role/deleteRole/${roleId}`,
    method: 'delete'
  })
}

export function getRoleMenuFunction(roleId) {
  return request({
    url: `/menu/getRoleMenuFunction/${roleId}`,
    method: 'get'
  })
}

export function getRoleFunction(roleId, parentId) {
  return request({
    url: `/menu/getRoleFunction/${roleId}/${parentId}`,
    method: 'get'
  })
}

export function updateRoleMenu(param) {
  return request({
    url: `/menu/updateRoleMenu`,
    method: 'post',
    data: param
  })
}

export function updateRoleFunction(param) {
  return request({
    url: `/menu/updateRoleFunction`,
    method: 'post',
    data: param
  })
}
/** =========================menu=======================**/

export function getMenuFunction() {
  return request({
    url: `/menu/getMenuFunction`,
    method: 'get'
  })
}

export function addOrUpdateMenu(param) {
  return request({
    url: `/menu/addOrUpdateMenu`,
    method: 'post',
    data: param
  })
}

export function deleteMenuFunction(menuFunctionId) {
  return request({
    url: `/menu/deleteMenuFunction/${menuFunctionId}`,
    method: 'delete'
  })
}
/** =========================log=======================**/

export function getLogList(param) {
  return request({
    url: `/log/getLogList`,
    method: 'post',
    data: param
  })
}

/** =========================UserType=======================**/
export function getUserTypeRoleList(param) {
  return request({
    url: `/UserTypeRole/getUserTypeRoleList`,
    method: 'post',
    data: param
  })
}

export function addOrUpdateUserType(param) {
  return request({
    url: `/UserTypeRole/addOrUpdateUserTypeRole`,
    method: 'post',
    data: param
  })
}
export function deleteUserTypeRole(userTypeRoleId) {
  return request({
    url: `/UserTypeRole/deleteUserTypeRole/${userTypeRoleId}`,
    method: 'delete'
  })
}

export function getUserTypeListByUserType(userType) {
  return request({
    url: `/UserTypeRole/getUserTypeList/${userType}`,
    method: 'get'
  })
}

export function initSetUserNameAndPwd(params) {
  return request({
    url: `/User/initSetUserNameAndPwd?NewUserName=${params.NewUserName}&UserId=${params.UserId}&NewPwd=${params.NewPwd}&access_token=${params.access_token}`,
    method: 'get'
  })
}

export function getPublishLogList(param) {
  return request({
    url: `/PublishLog/getPublishLogList`,
    method: 'post',
    data: param
  })
}

export function addOrUpdatePublishLog(param) {
  return request({
    url: `/PublishLog/addOrUpdatePublishLog`,
    method: 'post',
    data: param
  })
}

export function deletePublishLog(publishLogId) {
  return request({
    url: `/PublishLog/deletePublishLog/${publishLogId}`,
    method: 'delete'
  })
}

export function getInternationalizationList(param) {
  return request({
    url: `/Internationalization/getInternationalizationList`,
    method: 'post',
    data: param
  })
}

export function getFrontInternationalizationList() {
  return request({
    url: `/Internationalization/getFrontInternationalizationList`,
    method: 'get'
  })
}
export function addOrUpdateInternationalization(param) {
  return request({
    url: `/Internationalization/addOrUpdateInternationalization`,
    method: 'post',
    data: param
  })
}

export function deleteInternationalization(internationalizationId) {
  return request({
    url: `/Internationalization/deleteInternationalization/${internationalizationId}`,
    method: 'delete'
  })
}

export function batchAddInternationalization(param) {
  return request({
    url: `/Internationalization/batchAddInternationalization`,
    method: 'post',
    data: param
  })
}
// 管理端修改用户课题组
export function updateUserHospitalGroupInfo(data) {
  return request({
    url: `/User/updateUserHospitalGroupInfo`,
    method: 'put',
    data
  })
}
// 管理端修改用户角色
export function updateUserRoleInfo(data) {
  return request({
    url: `/User/updateUserRoleInfo`,
    method: 'put',
    data
  })
}
// 获取医院列表
export function getHIRHospitalList(param) {
  return request({
    url: `/Patient/getHIRHospitalList`,
    method: 'post',
    data: param
  })
}
// 删除医院
export function deleteHIRHospital(id) {
  return request({
    url: `/Patient/deleteHIRHospital/${id}`,
    method: 'delete',
  })
}
// 新增或修改医院
export function addOrUpdateHIRHospital(data) {
  return request({
    url: `/Patient/addOrUpdateHIRHospital`,
    method: 'post',
    data
  })
}
// 设置默认医院
export function updateDefaultHospital(params) {
  return request({
    url: `/Patient/updateDefaultHospital`,
    method: 'put',
    params
  })
}
// 获取课题组列表-不分页
export function getHospitalGroupList(data) {
  return request({
    url: `/HospitalGroup/getHospitalGroupList`,
    method: 'post',
    data
  })
}
// 获取课题组列表-分页
export function getHospitalGroupPageList(data) {
  return request({
    url: `/HospitalGroup/getHospitalGroupPageList`,
    method: 'post',
    data
  })
}
// 新增或编辑课题组
export function addOrUpdateHospitalGroup(data) {
  return request({
    url: `/HospitalGroup/addOrUpdateHospitalGroup`,
    method: 'post',
    data
  })
}
// 删除课题组
export function deleteHospitalGroup(id) {
  return request({
    url: `/HospitalGroup/deleteHospitalGroup/${id}`,
    method: 'delete'
  })
}
// 获取课题组相关ga
export function getGAUserList(params) {
  return request({
    url: `/HospitalGroup/getGAUserList`,
    method: 'get',
    params
  })
}
// 修改检查课题组
export function modifySCPStudyHospitalGroup(data) {
  return request({
    url: `/Patient/modifySCPStudyHospitalGroup`,
    method: 'post',
    data
  })
}
// 国际化获取迭代列表
export function getPublishVersionSelect() {
  return request({
    url: `/PublishLog/getPublishVersionSelect`,
    method: 'get',
  })
}
// 国际化批量更新
export function batchUpdateInternationalInfo(data) {
  return request({
    url: `/Internationalization/batchUpdateInternationalInfo`,
    method: 'put',
    data
  })
}

