修改诊断时间查询字段
This commit is contained in:
parent
07ed2e9c95
commit
89bf1116bc
@ -82,7 +82,7 @@ export const EcganalysisparasApi = {
|
|||||||
return await request.get({ url: `/tblist/ecganalysisparas/list?regId=${regId}&orgId=${orgId}` })
|
return await request.get({ url: `/tblist/ecganalysisparas/list?regId=${regId}&orgId=${orgId}` })
|
||||||
},
|
},
|
||||||
// 获取开始和结束时间的心电分析数据记录
|
// 获取开始和结束时间的心电分析数据记录
|
||||||
getDateStaAndEndData: async (orgId:String,startDate:String,endDate:String) => {
|
getDateStaAndEndData: async (doctorName:String,startDate:String,endDate:String) => {
|
||||||
return await request.get({ url: `/tblist/ecganalysisparas/getDateStaAndEndData?orgId=${orgId}&TimeSta=${startDate}&TimeEnd=${endDate}` })
|
return await request.get({ url: `/tblist/ecganalysisparas/getDateStaAndEndData?doctorName=${doctorName}&TimeSta=${startDate}&TimeEnd=${endDate}` })
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -63,13 +63,13 @@ const disabledDate = (time: Date) => {
|
|||||||
return time.getTime() > today.getTime()
|
return time.getTime() > today.getTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加一个生成日期数组的函数
|
// 修改生成日期数组的函数
|
||||||
const generateDateArray = (startDate: Date, endDate: Date) => {
|
const generateDateArray = (startDate: Date, endDate: Date) => {
|
||||||
const dates = []
|
const dates = []
|
||||||
let currentDate = new Date(startDate)
|
let currentDate = new Date(startDate)
|
||||||
|
|
||||||
while (currentDate <= endDate) {
|
while (currentDate <= endDate) {
|
||||||
dates.push(currentDate.toLocaleDateString('zh-CN', { month: '2-digit', day: '2-digit' }))
|
dates.push(formatDate(currentDate)) // 使用 formatDate 函数格式化日期
|
||||||
currentDate = new Date(currentDate.setDate(currentDate.getDate() + 1))
|
currentDate = new Date(currentDate.setDate(currentDate.getDate() + 1))
|
||||||
}
|
}
|
||||||
return dates
|
return dates
|
||||||
@ -86,7 +86,7 @@ async function getdata() {
|
|||||||
const startDate = `${formatDate(value.value[0])} 00:00:00`
|
const startDate = `${formatDate(value.value[0])} 00:00:00`
|
||||||
const endDate = `${formatDate(value.value[1])} 23:59:59`
|
const endDate = `${formatDate(value.value[1])} 23:59:59`
|
||||||
|
|
||||||
const data = await EcganalysisparasApi.getDateStaAndEndData(Profilevo.value.orgId, startDate, endDate)
|
const data = await EcganalysisparasApi.getDateStaAndEndData(Profilevo.value.doctorname, startDate, endDate)
|
||||||
cachedData.value = data // 保存数据
|
cachedData.value = data // 保存数据
|
||||||
updateChartWithData(data)
|
updateChartWithData(data)
|
||||||
}
|
}
|
||||||
@ -102,7 +102,21 @@ const updateChartWithData = (data: any[]) => {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
data: dateArray
|
data: dateArray
|
||||||
},
|
},
|
||||||
yAxis: {},
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
name: '诊断数量',
|
||||||
|
minInterval: 1, // 因为是计数,所以最小间隔设为1
|
||||||
|
min: 0, // 从0开始比较合理
|
||||||
|
axisLabel: {
|
||||||
|
formatter: '{value}'
|
||||||
|
},
|
||||||
|
splitLine: {
|
||||||
|
show: true,
|
||||||
|
lineStyle: {
|
||||||
|
type: 'dashed'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: '诊断数量',
|
name: '诊断数量',
|
||||||
@ -130,11 +144,19 @@ const handleDateChange = (val: [Date, Date]) => {
|
|||||||
value.value = [val[0], new Date(val[0].getTime() + 7 * 24 * 3600 * 1000 - 1)]
|
value.value = [val[0], new Date(val[0].getTime() + 7 * 24 * 3600 * 1000 - 1)]
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChart() // 使用新的更新图表方法
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加新的统计方法
|
// 修改日期格式化函数
|
||||||
|
const formatDate = (date: Date) => {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改统计方法中的日期格式化
|
||||||
const calculateDailyDiagnosisCounts = (data: any[], dateArray: string[]) => {
|
const calculateDailyDiagnosisCounts = (data: any[], dateArray: string[]) => {
|
||||||
// 初始化计数对象
|
// 初始化计数对象
|
||||||
const countMap = {}
|
const countMap = {}
|
||||||
@ -145,32 +167,23 @@ const calculateDailyDiagnosisCounts = (data: any[], dateArray: string[]) => {
|
|||||||
// 统计每天的诊断数量
|
// 统计每天的诊断数量
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
const date = new Date(item.doctorDiagTime)
|
const date = new Date(item.doctorDiagTime)
|
||||||
const dateStr = date.toLocaleDateString('zh-CN', { month: '2-digit', day: '2-digit' })
|
const dateStr = formatDate(date) // 使用相同的格式化函数
|
||||||
if (countMap[dateStr] !== undefined) {
|
if (countMap[dateStr] !== undefined) {
|
||||||
countMap[dateStr]++
|
countMap[dateStr]++
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 将统计结果转换为数组
|
|
||||||
return dateArray.map(date => countMap[date])
|
return dateArray.map(date => countMap[date])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改日期格式化
|
|
||||||
const formatDate = (date: Date) => {
|
|
||||||
const year = date.getFullYear()
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
||||||
const day = String(date.getDate()).padStart(2, '0')
|
|
||||||
return `${year}-${month}-${day}`
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改 onMounted
|
// 修改 onMounted
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getlogininfo()
|
getlogininfo()
|
||||||
// 设置默认时间范围为当前日期往前7天
|
// 设置默认时间范围为当前日期往前7天
|
||||||
const endDate = new Date()
|
const endDate = new Date()
|
||||||
const startDate = new Date(endDate.getTime() - 7 * 24 * 3600 * 1000)
|
const startDate = new Date(endDate.getTime() - 6 * 24 * 3600 * 1000)
|
||||||
value.value = [startDate, endDate]
|
value.value = [startDate, endDate]
|
||||||
updateChart()
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user