123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package com.bofeng.dao;
- import com.baomidou.mybatisplus.mapper.BaseMapper;
- import com.bofeng.entity.MsReport;
- import org.apache.ibatis.annotations.Mapper;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.annotations.Select;
- import org.springframework.stereotype.Repository;
- import java.util.List;
- /**
- * @Author: xielianghe
- * @Date: 2020/2/4 15:45
- */
- @Mapper
- @Repository
- public interface MsReportMapper extends BaseMapper<MsReport> {
- List<MsReport> selectByReportDate(@Param("reportDate") String reportDate, @Param("userCreate") Long userCreate);
- @Select("select * from ms_report where report_date<curdate() and user_create=#{userCreate} ORDER BY report_date desc LIMIT 1")
- List<MsReport> getNowByYesterdayDate(@Param("userCreate") Long userCreate);
- @Select("select user_create from ms_report where report_date<curdate() GROUP BY user_create")
- List<Long> getUserByYesterdayDate();
- @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=1")
- Long selectHouseIdByUserId(@Param("userId") Long userId);
- @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=1")
- List<Long> selectHouseIdsByUserId(@Param("userId") Long userId);
- //确诊
- @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and medical=1")
- Integer selectSuspectedNum(@Param("reportId") Long reportId);
- //隔离
- @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and single_room=1")
- Integer selectSingleRoomNum(@Param("reportId") Long reportId);
- //正常
- @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and suspected_status=0")
- Integer selectisSuspectedNum(@Param("reportId") Long reportId);
- //疑似
- @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and suspected_status=1")
- Integer selectisNoSuspectedNum(@Param("reportId") Long reportId);
- /**
- * 最近3天是否都有上报
- *
- * @param userId
- * @return
- */
- @Select("select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 1 day) and user_create=#{userId}\n" +
- "union\n" +
- "select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 2 day) and user_create=#{userId}\n" +
- "union\n" +
- "select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 3 day) and user_create=#{userId}")
- List<MsReport> selectMsReportLate(@Param("userId") Long userId);
- /**
- * 用户自身的健康状态, list大于0健康,等于0不健康
- *
- * @param userId
- * @return
- */
- @Select("select * from ms_report where report_status=1 and report_date=curdate() and ms_status=1 and user_create=#{userId}")
- List<MsReport> selectMsReportToday(@Param("userId") Long userId);
- }
|