/*
 *    Copyright (c) 2018-2025, cyweb All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 */

import request from '/@/utils/request';

/**
 * 获取列表
 * @param query
 */
export const fetchList = (query?: any) => {
	return request({
		url: '/basic/basicstudent/page',
		method: 'get',
		params: query,
	});
};

/**
 * 新增
 * @param obj
 */
export const addObj = (obj: any) => {
	return request({
		url: '/basic/basicstudent',
		method: 'post',
		data: obj,
	});
};

/**
 * 获取详情
 * @param id
 */
export const getObj = (id: string | number) => {
	return request({
		url: `/basic/basicstudent/${id}`,
		method: 'get',
	});
};

/**
 * 根据学号获取信息
 * @param stuNo
 */
export const getInfo = (stuNo: string | number) => {
	return request({
		url: `/basic/basicstudent/getInfoByStuNo/${stuNo}`,
		method: 'get',
	});
};

/**
 * 获取学生信息
 * @param query
 */
export const getStuInfo = (query: any) => {
	return request({
		url: '/basic/basicstudent/getStuInfo',
		method: 'post',
		data: query,
	});
};

/**
 * 获取学生医生日志
 * @param query
 */
export const getStuDocterLog = (query?: any) => {
	return request({
		url: '/stuwork/stuvisitlog/getStuDocterLog',
		method: 'get',
		params: query,
	});
};

/**
 * 根据ID获取学生医生信息
 * @param query
 */
export const getStuDocterById = (query?: any) => {
	return request({
		url: '/stuwork/stuvisitlog',
		method: 'get',
		params: query,
	});
};

/**
 * 添加学生医生信息
 * @param obj
 */
export const addStuDocter = (obj: any) => {
	return request({
		url: '/stuwork/stuvisitlog',
		method: 'post',
		data: obj,
	});
};

/**
 * 删除学生医生信息
 * @param query
 */
export const delStuDocter = (query: any) => {
	return request({
		url: '/stuwork/stuvisitlog/removeById',
		method: 'post',
		data: query,
	});
};

/**
 * 添加处理
 * @param query
 */
export const addHand = (query: any) => {
	return request({
		url: '/stuwork/stuvisitlog/addHand',
		method: 'post',
		data: query,
	});
};

/**
 * 删除
 * @param id
 */
export const delObj = (id: string | number) => {
	return request({
		url: `/basic/basicstudent/${id}`,
		method: 'delete',
	});
};

/**
 * 更新
 * @param obj
 */
export const putObj = (obj: any) => {
	return request({
		url: '/basic/basicstudent',
		method: 'put',
		data: obj,
	});
};

/**
 * 保存学生
 * @param obj
 */
export const saveStu = (obj: any) => {
	return request({
		url: '/basic/basicstudent/saveStu',
		method: 'post',
		data: obj,
	});
};

/**
 * 编辑是否负责人
 * @param obj
 */
export const editIsleader = (obj: any) => {
	return request({
		url: '/basic/basicstudent/editIsleader',
		method: 'post',
		data: obj,
	});
};

/**
 * 修改学生信息(idCard,bankCard,phone) - 免学费申请时
 * @param obj
 */
export const updateStuInfo = (obj: any) => {
	return request({
		url: '/basic/basicstudent/updateStuInfo',
		method: 'put',
		data: obj,
	});
};

/**
 * 根据班级代码获取学生
 * @param classCode
 */
export const getSttudentByClassCode = (classCode: string | number) => {
	return request({
		url: `/basic/basicstudent/initStuScoreData/${classCode}`,
		method: 'get',
	});
};

/**
 * 根据班级查询学生列表
 * @param query
 */
export const queryStudentListByClass = (query?: any) => {
	return request({
		url: '/basic/basicstudent/queryStudentListByClass',
		method: 'get',
		params: query,
	});
};

/**
 * 查询成绩列表
 * @param query
 */
export const queryScoreList = (query?: any) => {
	return request({
		url: '/basic/basicstudent/queryScoreData',
		method: 'post',
		params: query,
	});
};

/**
 * 根据班级代码查询学生数量
 * @param query
 */
export const queryStuNumByClassCode = (query?: any) => {
	return request({
		url: '/basic/basicstudent/queryStuNumByClassCode',
		method: 'get',
		params: query,
	});
};

/**
 * 打印前准备
 * @param stuNo
 */
export const prePrint = (stuNo: string | number) => {
	return request({
		url: `/basic/basicstudent/prePrint/${stuNo}`,
		method: 'get',
	});
};

/**
 * 更换随机二维码
 * @param stuNo
 * @param qrStr
 */
export const changeQrStr = (stuNo: string | number, qrStr: string) => {
	return request({
		url: `/basic/basicstudent/changeQrStr/${stuNo}/${qrStr}`,
		method: 'get',
	});
};

/**
 * 获取学生状态
 */
export const getStuStatus = () => {
	return request({
		url: '/admin/dict/item/type/student_status',
		method: 'get',
	});
};

/**
 * 重置密码
 * @param data
 */
export const resetPassWord = (data: any) => {
	return request({
		url: '/basic/basicstudent/resetPassWord',
		method: 'post',
		data: data,
	});
};

/**
 * 根据学号查询在校学生
 * @param data
 */
export const queryStudentByStuNo = (data?: any) => {
	return request({
		url: '/basic/basicstudent/queryStudentByStuNo',
		method: 'get',
		params: data,
	});
};

/**
 * 根据学号后6位查询在校学生
 * @param data
 */
export const queryStudentByLastStuNo = (data?: any) => {
	return request({
		url: '/basic/basicstudent/queryStudentByLastStuNo',
		method: 'get',
		params: data,
	});
};

/**
 * 根据学号查询学生
 * @param data
 */
export const queryAllStudentByStuNo = (data?: any) => {
	return request({
		url: '/basic/basicstudent/queryAllStudentByStuNo',
		method: 'get',
		params: data,
	});
};

/**
 * 根据班级代码查询所有学生
 * @param classCode
 */
export const queryAllStudentByClassCode = (classCode: string | number) => {
	return request({
		url: `/basic/basicstudent/queryAllStudentByClassCode/${classCode}`,
		method: 'get',
	});
};

/**
 * 导出头像
 * @param data
 */
export const getDownPic = (data?: any) => {
	return request({
		url: '/basic/basicstudent/getDownPic',
		method: 'get',
		responseType: 'blob',
		headers: { 'Content-Type': 'application/json; application/octet-stream' },
		params: data,
	});
};

/**
 * 更新进出状态
 * @param data
 */
export const updateInout = (data: any) => {
	return request({
		url: '/basic/basicstudent/updateInout',
		method: 'post',
		data: data,
	});
};

/**
 * 批量打印前准备
 * @param data
 */
export const preBatchPrint = (data: any) => {
	return request({
		url: '/basic/basicstudent/preBatchPrint',
		method: 'post',
		data: data,
	});
};

/**
 * 查询学生信息（成绩答辩用）
 * @param query
 */
export const queryStuInfoForScoreDefend = (query?: any) => {
	return request({
		url: '/basic/basicstudent/queryStuInfoForScoreDefend',
		method: 'get',
		params: query,
	});
};

/**
 * 更新学生简单信息
 * @param data
 */
export const updateStuSimpleInfo = (data: any) => {
	return request({
		url: '/basic/basicstudent/updateStuSimpleInfo',
		method: 'post',
		data: data,
	});
};

/**
 * 查询专业学生信息
 * @param data
 */
export const queryMajorStuInfo = (data: any) => {
	return request({
		url: '/basic/basicstudent/queryMajorStuInfo',
		method: 'post',
		data: data,
	});
};

/**
 * 导出学生信息卡
 * @param data
 */
export const exportStuInfoCard = (data: any) => {
	return request({
		url: '/basic/file/exportStuInfoCard',
		method: 'post',
		data: data,
		responseType: 'blob',
	});
};

/**
 * 搜索
 * @param query
 */
export const search = (query: string | number) => {
	return request({
		url: `/basic/basicstudent/search/${query}`,
		method: 'get',
	});
};

/**
 * 根据编号查询学生基础信息
 * @param obj
 */
export const queryStuBaseByNo = (obj: string | number) => {
	return request({
		url: `/basic/basicstudent/queryStuBaseByNo/${obj}`,
		method: 'get',
	});
};

/**
 * 学生巡检列表
 * @param query
 */
export const queryStuindex = (query?: any) => {
	return request({
		url: '/basic/basicstudent/queryStuindex',
		method: 'get',
		params: query,
	});
};

/**
 * 获取头像列表
 */
export const avatarList = () => {
	return request({
		url: '/basic/basicstudent/avatar/list',
		method: 'get',
	});
};

/**
 * 批量更新头像审核状态
 * @param data
 */
export const batchUpdateAvatarAudit = (data: any) => {
	return request({
		url: '/basic/basicstudent/avatar/batchUpdate',
		method: 'post',
		data: data,
	});
};

/**
 * 学生信息导出
 * @param data
 */
export const exportStudentData = (data: any) => {
	return request({
		url: '/basic/basicstudent/stuDataExport',
		method: 'post',
		data: data,
		responseType: 'blob',
	});
};

/**
 * 申请顶岗
 * @param data
 * TODO: 接口文档中未找到此接口，请提供正确的接口地址
 */
export const applyInternship = (data: any) => {
	return request({
		url: '/basic/basicstudent/applyInternship', // TODO: 接口文档中未找到此接口
		method: 'post',
		data: data,
	});
};

/**
 * 段段清证书导入
 * @param formData
 * TODO: 接口文档中未找到此接口，请提供正确的接口地址
 */
export const importCertificate = (formData: FormData) => {
	return request({
		url: '/basic/basicstudent/importCertificate', // TODO: 接口文档中未找到此接口
		method: 'post',
		data: formData,
		headers: {
			'Content-Type': 'multipart/form-data',
		},
	});
};

/**
 * 证书导出
 * @param data
 * TODO: 接口文档中未找到此接口，请提供正确的接口地址
 */
export const exportCertificate = (data: any) => {
	return request({
		url: '/basic/basicstudent/exportCertificate', // TODO: 接口文档中未找到此接口
		method: 'post',
		data: data,
		responseType: 'blob',
	});
};

