CovidVaccinateAppointmentDao.java 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. package thyyxxk.webserver.dao.his.querydata;
  2. import com.baomidou.mybatisplus.core.conditions.Wrapper;
  3. import com.baomidou.mybatisplus.core.metadata.IPage;
  4. import com.baomidou.mybatisplus.core.toolkit.Constants;
  5. import org.apache.ibatis.annotations.*;
  6. import thyyxxk.webserver.entity.querydata.CovidVaccinateAppointment;
  7. import thyyxxk.webserver.entity.querydata.CovidVaccinateFactory;
  8. import thyyxxk.webserver.entity.querydata.CovidVaccinateThreshold;
  9. import thyyxxk.webserver.entity.querydata.ZdCovidVaccinate;
  10. import java.util.Date;
  11. import java.util.List;
  12. /**
  13. * <p>
  14. * 新冠接种预约 Mapper 接口
  15. * </p>
  16. *
  17. * @author 肖蟾
  18. * @since 2021-03-16
  19. */
  20. @Mapper
  21. public interface CovidVaccinateAppointmentDao {
  22. /**
  23. * 获取到新冠疫苗预约日期的最大值
  24. *
  25. * @return 返回最大的日期
  26. */
  27. @Select("select max(date) as date from t_covid_vaccinate_threshold")
  28. Date maxDate();
  29. /**
  30. * 统一修改 或者 单个修改阈值
  31. *
  32. * @param dataList 传入 id 和 value
  33. */
  34. @Update("<script>" +
  35. "<foreach item='item' collection='dataList' >" +
  36. "update t_covid_vaccinate_threshold_new set " +
  37. "value = #{item.value} where id=#{item.id} " +
  38. "</foreach>" +
  39. "</script>")
  40. void xiuGaiYuZhi(@Param("dataList") List<CovidVaccinateThreshold> dataList);
  41. /**
  42. * 使用了MyBatis-Plus 来查询并分页 新冠疫苗的人数
  43. *
  44. * @param page 分页的条件 current size
  45. * @param queryWrapper 这个是mybatis-plus的条件构造器
  46. * @return 返回一个分页的对象 包含 符合分页条件的数据 和 符合条件数据条数
  47. */
  48. @Select("select patient_id,a.name,sex, " +
  49. "phone,social_no,age,corp_name, " +
  50. "job_category_to_string=(b.name),execute_date,vaccinate_code,vaccinate_name,vaccinate_factory " +
  51. "from t_covid_vaccinate_appointment a " +
  52. "inner join t_covid_appointment_job_category_dict b on (b.id = job_category) ${ew.customSqlSegment} and " +
  53. "isnull(del_flag,0)=0")
  54. IPage<CovidVaccinateAppointment> mybatisPlusQueryXGYM(IPage<CovidVaccinateAppointment> page,
  55. @Param(Constants.WRAPPER) Wrapper<CovidVaccinateAppointment> queryWrapper);
  56. /**
  57. * 新增疫苗种类
  58. * 这个 @Options(useGeneratedKeys = true,keyColumn = "id" , keyProperty = "id") 是在插入的时候返回这个自增的id
  59. *
  60. * @param param name:疫苗名字 enableFlag:是否可以预约 bookTip:描述
  61. * @return 返回状态
  62. */
  63. @Insert("insert into t_zd_covid_vaccinate (name,enable_flag,book_tip) values (#{name},#{enableFlag},#{bookTip})")
  64. @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
  65. void xinZengYiMiao(ZdCovidVaccinate param);
  66. /**
  67. * 插入对应的 疫苗的厂家
  68. *
  69. * @param param 需要插入的字段有 code主键不允许重复 vaccinateId:对应的疫苗
  70. * specification:规格 price:金额,name;名字,enableFlag:是否允许预约
  71. */
  72. @Insert("<script>" +
  73. "insert into t_covid_vaccinate_factory (code, vaccinate_id, specification, price, name,enable_flag) " +
  74. "values" +
  75. "<foreach collection='param' item='item' index='index' separator=','>" +
  76. " (#{item.code},#{item.vaccinateId},#{item.specification},#{item.price},#{item.name},#{item.enableFlag})" +
  77. "</foreach>" +
  78. "</script>")
  79. void xinZengChangJia(List<CovidVaccinateFactory> param);
  80. /**
  81. * 查询全部的疫苗名称
  82. *
  83. * @return 返回全部的数据
  84. */
  85. @Select("select * from t_zd_covid_vaccinate")
  86. List<ZdCovidVaccinate> chaKanYiMiao();
  87. /**
  88. * 查询全部的疫苗名称
  89. *
  90. * @param id 对应的疫苗
  91. * @return 对应的数据
  92. */
  93. @Select("select *,(b.date) date,(b.value) value,(b.id) id from t_covid_vaccinate_factory a left join t_covid_vaccinate_threshold_new b on " +
  94. "(a.code = b.code and date = convert(char(10),getdate(),120)) where vaccinate_id=#{id}")
  95. List<CovidVaccinateFactory> chaKanChangJia(@Param("id") Integer id);
  96. /**
  97. * 在插入 厂家信息的时候查看 是否以及存在了
  98. *
  99. * @param dataList 多个 code
  100. * @return 返回 id 用来给前端查看
  101. */
  102. @Select("<script>" +
  103. "select vaccinate_id from t_covid_vaccinate_factory where code in " +
  104. "<foreach item='item' collection='dataList' open='(' separator=',' close=')'>" +
  105. "#{item.code}" +
  106. "</foreach>" +
  107. "</script>")
  108. List<Integer> changJiaCodePanDuan(@Param("dataList") List<CovidVaccinateFactory> dataList);
  109. /**
  110. * 根据id来修改 疫苗的一些字段
  111. *
  112. * @param param 修改的字段为 name enableFlag bookTip 通过id来修改
  113. */
  114. @Update("update t_zd_covid_vaccinate set name=#{name},enable_flag=#{enableFlag},book_tip=#{bookTip} where id=#{id}")
  115. void xiuGaiYiMiao(ZdCovidVaccinate param);
  116. /**
  117. * 根据code来修改厂家
  118. *
  119. * @param param 根据code来修改 能修改的值为
  120. * @return 返回boolean
  121. */
  122. @Update("update t_covid_vaccinate_factory set specification=#{specification},price=#{price}," +
  123. "name=#{name},enable_flag=#{enableFlag} where code =#{code}")
  124. void xiuGaiChangJia(CovidVaccinateFactory param);
  125. /**
  126. * 删除厂家 根据code来删除
  127. *
  128. * @param code 删除条件
  129. */
  130. @Delete("delete t_covid_vaccinate_factory where code=#{code}")
  131. void shanChuChangJia(@Param("code") Integer code);
  132. /**
  133. * 查看可以预约 新冠疫苗厂家的信息
  134. *
  135. * @return 返回一个list的集合
  136. */
  137. @Select("select code,a.name ,(b.name) vaccinate_name from t_covid_vaccinate_factory a inner join " +
  138. "t_zd_covid_vaccinate b on (a.vaccinate_id = b.id) " +
  139. "where a.enable_flag =1 ")
  140. List<CovidVaccinateFactory> kaiQiYuYueChangJia();
  141. /**
  142. * 查看厂家的code 和 日期 是否存在
  143. *
  144. * @param code 厂家的code
  145. * @return 返回最大值的日期
  146. */
  147. @Select("select max(date) as date from t_covid_vaccinate_threshold_new where code = #{code}")
  148. Date changJiaYuZhiDoesItExist(@Param("code") int code);
  149. /**
  150. * 插入每个疫苗厂家的限制阈值
  151. *
  152. * @param code 厂家的code
  153. * @param dateList 七天的日期
  154. * @param value 阈值 从一开始就获取到的
  155. */
  156. @Insert("<script>" +
  157. "insert into t_covid_vaccinate_threshold_new (code, date, value) values " +
  158. "<foreach collection='dateList' item='item' separator=','>" +
  159. "(#{code},#{item},#{value})" +
  160. "</foreach>" +
  161. "</script>")
  162. void chaRuMeiYouDeDate(@Param("code") int code,
  163. @Param("dateList") List<Date> dateList,
  164. @Param("value") int value);
  165. /**
  166. * 查看阈值
  167. *
  168. * @param code 根据产品编码
  169. * @param startTime 开始时间
  170. * @param endTime 结束时间
  171. * @return 返回七天数据
  172. */
  173. @Select("select * from t_covid_vaccinate_threshold_new where code=#{code} and date>=#{startTime} and date<=#{endTime} order by date")
  174. List<CovidVaccinateThreshold> chaKanQiTianYuZhi(@Param("code") int code,
  175. @Param("startTime") String startTime,
  176. @Param("endTime") String endTime);
  177. @Update("update t_covid_vaccinate_factory set enable_flag=#{enableFlag} where code = #{code}")
  178. void kaiQiHuoGuanBiYuYue(@Param("code") Integer code,
  179. @Param("enableFlag") Integer enableFlag);
  180. }