refactor(health): 小程序端适配后端API重构

- 新增 medicationTask.js 替代 medicationRecord.js
- 新增 medicationAdherence.js 依从性统计API
This commit is contained in:
bot5
2026-03-19 21:38:32 +08:00
parent 366313a1e5
commit 5742b16a3e
3 changed files with 74 additions and 79 deletions

View File

@@ -0,0 +1,46 @@
import request from '@/utils/request'
// 获取总体依从性统计
export function getOverallAdherence(query) {
return request({
url: '/health/adherence/overall',
method: 'get',
params: query
})
}
// 获取每日依从性统计列表
export function getDailyAdherence(query) {
return request({
url: '/health/adherence/daily',
method: 'get',
params: query
})
}
// 获取日历视图数据
export function getCalendarData(memberId, yearMonth) {
return request({
url: '/health/adherence/calendar',
method: 'get',
params: { memberId, yearMonth }
})
}
// 获取各时段服药统计
export function getTimeSlotAdherence(query) {
return request({
url: '/health/adherence/timeSlot',
method: 'get',
params: query
})
}
// 获取仪表盘概览数据
export function getDashboard(memberId) {
return request({
url: '/health/adherence/dashboard',
method: 'get',
params: { memberId }
})
}

View File

@@ -1,79 +0,0 @@
import request from '@/utils/request'
// 查询用药记录列表
export function listMedicationRecord(query) {
return request({
url: '/health/medicationRecord/list',
method: 'get',
params: query
})
}
// 查询今日用药记录
export function getTodayRecords(personId) {
return request({
url: '/health/medicationRecord/today',
method: 'get',
params: { personId }
})
}
// 查询某计划某天的用药记录
export function getRecordsByPlanAndDate(planId, date) {
return request({
url: '/health/medicationRecord/plan/' + planId + '/date/' + date,
method: 'get'
})
}
// 查询用药记录详细
export function getMedicationRecord(id) {
return request({
url: '/health/medicationRecord/' + id,
method: 'get'
})
}
// 新增用药记录
export function addMedicationRecord(data) {
return request({
url: '/health/medicationRecord',
method: 'post',
data
})
}
// 修改用药记录
export function updateMedicationRecord(data) {
return request({
url: '/health/medicationRecord',
method: 'put',
data
})
}
// 删除用药记录
export function delMedicationRecord(id) {
return request({
url: '/health/medicationRecord/' + id,
method: 'delete'
})
}
// 服药(标记为已服用)
export function takeMedication(id, dosage, remark) {
return request({
url: '/health/medicationRecord/take/' + id,
method: 'put',
params: { dosage, remark }
})
}
// 跳过服药
export function skipMedication(id, remark) {
return request({
url: '/health/medicationRecord/skip/' + id,
method: 'put',
params: { remark }
})
}

View File

@@ -0,0 +1,28 @@
import request from '@/utils/request'
// 查询服药任务列表
export function listMedicationTask(query) {
return request({
url: '/health/medicationTask/list',
method: 'get',
params: query
})
}
// 确认服药
export function confirmMedication(id, confirmType) {
return request({
url: '/health/medicationTask/confirm/' + id,
method: 'put',
params: { confirmType }
})
}
// 跳过服药
export function skipMedication(id, notes) {
return request({
url: '/health/medicationTask/skip/' + id,
method: 'put',
params: { notes }
})
}