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


//疫情上报
export function report(params) {
	return request({
		url: '/mobile/messageReportApi/add',
		data: Qs.stringify(params),
		method: 'post',
	})
}

//获取测温记录
export function getTemperatureList(params) {
	return request({
		url: '/mobile/personDeviceLogApi/queryTemperatureRecordListByEnt',
		data: Qs.stringify(params),
		method: 'post',
	})
}

//获取未测人员列表
export function queryUnmeasureGroupList(params) {
	return request({
		url: '/mobile/PersonDeviceFilterLog/queryUnmeasureGroupList',
		data: Qs.stringify(params),
		method: 'post',
	})
}

//获取管理员的公司列表
export function getCompanyList(params) {
	return request({
		url: '/mobile/personDeviceLogApi/queryCompanyList',
		data: Qs.stringify(params),
		method: 'post',
	})
}

//切换当前管理的单位
export function switchCompany(params) {
	return request({
		url: '/mobile/personInfoApi/switchCompany',
		data: Qs.stringify(params),
		method: 'post',
	})
}

//获取考勤统计时段列表
export function getAttednanceTimeList(params) {
	return request({
		url: '/mobile/workAttendance/findAttendancePeriod',
		params: params,
		method: 'get',
	})
}

//获取考勤列表数据
export function getAttednance(params) {
	return request({
		url: '/mobile/workAttendance/workAttendanceStat',
		params: params,
		method: 'get',
	})
}

//获取健康档案列表
export function getHealthyPersonList(params) {
	return request({
		url: '/mobile/IndividualLogApi/healthyPersonList',
		data: Qs.stringify(params),
		method: 'post',
	})
}


//
export function healthShowNumData(params) {
	return request({
		url: '/mobile/healthShowApi/numData',
		data: Qs.stringify(params),
		method: 'post',
	})
}
//
export function healthShowPicData(params) {
	return request({
		url: '/mobile/healthShowApi/picData',
		data: Qs.stringify(params),
		method: 'post',
	})
}

//获取异常统计
export function getAbnormalStatistics(params) {
	return request({
		url: '/mobile/personDeviceLogApi/unusualStatistics',
		data: Qs.stringify(params),
		method: 'post',
	})
}
//获取未检测人员列表
export function getUndetectedPersonList(params) {
	return request({
		url: '/mobile/personDeviceLogApi/undetectedPersonList',
		data: Qs.stringify(params),
		method: 'post',
	})
}

//获取健康档案统计,popedom默认1查用户  3查职工
export function getHealthyCodeStat(companyId, popedom) {
	return request({
		url: '/mobile/healthShowApi/healthyCodeStat',
		params: {
			companyId: companyId,
			popedom: popedom
		},
		method: 'get',
	})
}

export function workerPageList(queryModel) {
	return request({
		url: '/mobile/personHealthLedgerApi/workerPageList',
		data: Qs.stringify(queryModel),
		method: 'post',
		timeout: 30000
	})
}

//通知详情
export function getPersonInfo(popedom) {
	var formData = new FormData()
	formData.append('popedom', popedom);
	return request.post('/mobile/personHealthLedgerApi/getPersonInfo', formData)
}
export function curDateIsUpload() {
	return request.get('/mobile/personHealthLedgerApi/curDateIsUpload')
}
export function getHealthStatusList() {
	return request.post('/mobile/personHealthLedgerApi/getHealthStatusList')
}

export function uploadPicture(fileData) {
	var formData = new FormData()

	formData.append('subFolder', "personHealthLedger");
	formData.append('photoFile', fileData, `${+new Date()}.jpg`);

	return request({
		url: '/uploadPicture',
		method: 'post',
		data: formData
	})
}

export function save(report) {
	return request.post('/mobile/personHealthLedgerApi/save', report, {
		headers: {
			"Content-Type": "application/json"
		},
		timeout: 30000
	});
}


//查询学生信息
export function getDetail(id, popedom) {
	return request({
		url: '/mobile/personHealthLedgerApi/detail?id=' + id + "&popedom=" + popedom,
		method: 'get',
	})
}

//获取疫情上报记录
export function getReportList() {
	return request({
		url: '/mobile/epidemicReportApi/pageList',
		data: Qs.stringify({}),
		method: 'post',
	})
}

//获取疫情上报记录详情
export function getReportInfo(id) {
	return request({
		url: '/mobile/epidemicReportApi/detail/' + id,
		method: 'get',
	})
}
