package cn.iocoder.yudao.module.system.dal.mysql.biz;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.EmergencyTrackingPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.ElderlyEmergencyTrackingDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 长者应急跟踪 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface EmergencyTrackingMapper extends BaseMapperX<ElderlyEmergencyTrackingDO> {

    default PageResult<ElderlyEmergencyTrackingDO> selectPage(EmergencyTrackingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ElderlyEmergencyTrackingDO>()
                .eqIfPresent(ElderlyEmergencyTrackingDO::getElderId, reqVO.getElderId())
                .likeIfPresent(ElderlyEmergencyTrackingDO::getElderName, reqVO.getElderName())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getElderSex, reqVO.getElderSex())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getBedId, reqVO.getBedId())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getBirthday, reqVO.getBirthday())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getCreatedBy, reqVO.getCreatedBy())
                .betweenIfPresent(ElderlyEmergencyTrackingDO::getReceptionTime, reqVO.getReceptionTime())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getReceptionContent, reqVO.getReceptionContent())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getIsCanHandle, reqVO.getIsCanHandle())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getTreatingProcesses, reqVO.getTreatingProcesses())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getEmergencyMedicalTreatment, reqVO.getEmergencyMedicalTreatment())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getAccompanyingPerson, reqVO.getAccompanyingPerson())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getFollowUpPersonnel, reqVO.getFollowUpPersonnel())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getFollowUpFellow, reqVO.getFollowUpFellow())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getPhysicalCondition,reqVO.getPhysicalCondition())
                .betweenIfPresent(ElderlyEmergencyTrackingDO::getFollowUpTime, reqVO.getFollowUpTime())
                .eqIfPresent(ElderlyEmergencyTrackingDO::getOrgType, reqVO.getOrgType())
                .inIfPresent(ElderlyEmergencyTrackingDO::getTenantId,reqVO.getTenantIds())
                .orderByDesc(ElderlyEmergencyTrackingDO::getReceptionTime));
    }

}