MsReportMapper.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package com.bofeng.dao;
  2. import com.baomidou.mybatisplus.mapper.BaseMapper;
  3. import com.bofeng.entity.MsReport;
  4. import org.apache.ibatis.annotations.Mapper;
  5. import org.apache.ibatis.annotations.Param;
  6. import org.apache.ibatis.annotations.Select;
  7. import org.springframework.stereotype.Repository;
  8. import java.util.List;
  9. /**
  10. * @Author: xielianghe
  11. * @Date: 2020/2/4 15:45
  12. */
  13. @Mapper
  14. @Repository
  15. public interface MsReportMapper extends BaseMapper<MsReport> {
  16. List<MsReport> selectByReportDate(@Param("reportDate") String reportDate, @Param("userCreate") Long userCreate);
  17. @Select("select * from ms_report where report_date<curdate() and user_create=#{userCreate} ORDER BY report_date desc LIMIT 1")
  18. List<MsReport> getNowByYesterdayDate(@Param("userCreate") Long userCreate);
  19. @Select("select user_create from ms_report where report_date<curdate() GROUP BY user_create")
  20. List<Long> getUserByYesterdayDate();
  21. @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=1")
  22. Long selectHouseIdByUserId(@Param("userId") Long userId);
  23. @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=1")
  24. List<Long> selectHouseIdsByUserId(@Param("userId") Long userId);
  25. //确诊
  26. @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and medical=1")
  27. Integer selectSuspectedNum(@Param("reportId") Long reportId);
  28. //隔离
  29. @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and single_room=1")
  30. Integer selectSingleRoomNum(@Param("reportId") Long reportId);
  31. //正常
  32. @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and suspected_status=0")
  33. Integer selectisSuspectedNum(@Param("reportId") Long reportId);
  34. //疑似
  35. @Select("select count(suspected_id) from ms_suspected where report_id=#{reportId} and suspected_status=1")
  36. Integer selectisNoSuspectedNum(@Param("reportId") Long reportId);
  37. /**
  38. * 最近3天是否都有上报
  39. *
  40. * @param userId
  41. * @return
  42. */
  43. @Select("select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 1 day) and user_create=#{userId}\n" +
  44. "union\n" +
  45. "select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 2 day) and user_create=#{userId}\n" +
  46. "union\n" +
  47. "select * from ms_report where report_status=1 and report_date=date_sub(curdate(),interval 3 day) and user_create=#{userId}")
  48. List<MsReport> selectMsReportLate(@Param("userId") Long userId);
  49. /**
  50. * 用户自身的健康状态, list大于0健康,等于0不健康
  51. *
  52. * @param userId
  53. * @return
  54. */
  55. @Select("select * from ms_report where report_status=1 and report_date=curdate() and ms_status=1 and user_create=#{userId}")
  56. List<MsReport> selectMsReportToday(@Param("userId") Long userId);
  57. }