package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.SymptomRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

/**
 * 症状记录Mapper接口
 */
@Mapper
public interface SymptomRecordMapper extends BaseMapper<SymptomRecord> {
    
    /**
     * 查询症状记录并关联患者信息
     * @param patientId 患者ID (可选)
     * @return 症状记录列表
     */
    List<SymptomRecord> selectWithPatient(@Param("patientId") Integer patientId);

    /**
     * 根据患者ID和日期范围查询症状记录
     */
    @Select("SELECT * FROM symptom_record " +
            "WHERE patient_id = #{patientId} " +
            "AND record_time BETWEEN #{startDate} AND #{endDate} " +
            "ORDER BY record_time ASC")
    List<SymptomRecord> selectByPatientIdAndDateRange(
            @Param("patientId") Integer patientId,
            @Param("startDate") LocalDate startDate,
            @Param("endDate") LocalDate endDate);
} 