import request from '@/utils/request'

// 查询服药记录列表
export function listMedicationRecord(query) {
  return request({
    url: '/health/medicationRecord/list',
    method: 'get',
    params: query
  })
}

// 查询今日待服药记录
export function getTodayRecords() {
  return request({
    url: '/health/medicationRecord/today',
    method: 'get'
  })
}

// 根据计划ID和日期查询服药记录
export function getRecordsByPlanAndDate(planId, recordDate) {
  return request({
    url: '/health/medicationRecord/byPlanDate',
    method: 'get',
    params: { planId, recordDate }
  })
}

// 确认服药
export function takeMedication(id, dosage, actualTime) {
  return request({
    url: '/health/medicationRecord/take/' + id,
    method: 'put',
    params: { dosage, actualTime }
  })
}

// 跳过服药
export function skipMedication(id, reason) {
  return request({
    url: '/health/medicationRecord/skip/' + id,
    method: 'put',
    params: { reason }
  })
}
