123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- package thyyxxk.webserver.dao.his.querydata;
- import com.baomidou.mybatisplus.core.conditions.Wrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.core.toolkit.Constants;
- import org.apache.ibatis.annotations.*;
- import thyyxxk.webserver.entity.querydata.CovidVaccinateAppointment;
- import thyyxxk.webserver.entity.querydata.CovidVaccinateFactory;
- import thyyxxk.webserver.entity.querydata.CovidVaccinateThreshold;
- import thyyxxk.webserver.entity.querydata.ZdCovidVaccinate;
- import java.util.Date;
- import java.util.List;
- /**
- * <p>
- * 新冠接种预约 Mapper 接口
- * </p>
- *
- * @author 肖蟾
- * @since 2021-03-16
- */
- @Mapper
- public interface CovidVaccinateAppointmentDao {
- /**
- * 获取到新冠疫苗预约日期的最大值
- *
- * @return 返回最大的日期
- */
- @Select("select max(date) as date from t_covid_vaccinate_threshold")
- Date maxDate();
- /**
- * 统一修改 或者 单个修改阈值
- *
- * @param dataList 传入 id 和 value
- */
- @Update("<script>" +
- "<foreach item='item' collection='dataList' >" +
- "update t_covid_vaccinate_threshold_new set " +
- "value = #{item.value} where id=#{item.id} " +
- "</foreach>" +
- "</script>")
- void xiuGaiYuZhi(@Param("dataList") List<CovidVaccinateThreshold> dataList);
- /**
- * 使用了MyBatis-Plus 来查询并分页 新冠疫苗的人数
- *
- * @param page 分页的条件 current size
- * @param queryWrapper 这个是mybatis-plus的条件构造器
- * @return 返回一个分页的对象 包含 符合分页条件的数据 和 符合条件数据条数
- */
- @Select("select patient_id,a.name,sex, " +
- "phone,social_no,age,corp_name, " +
- "job_category_to_string=(b.name),execute_date,vaccinate_code,vaccinate_name,vaccinate_factory " +
- "from t_covid_vaccinate_appointment a " +
- "inner join t_covid_appointment_job_category_dict b on (b.id = job_category) ${ew.customSqlSegment} and " +
- "isnull(del_flag,0)=0")
- IPage<CovidVaccinateAppointment> mybatisPlusQueryXGYM(IPage<CovidVaccinateAppointment> page,
- @Param(Constants.WRAPPER) Wrapper<CovidVaccinateAppointment> queryWrapper);
- /**
- * 新增疫苗种类
- * 这个 @Options(useGeneratedKeys = true,keyColumn = "id" , keyProperty = "id") 是在插入的时候返回这个自增的id
- *
- * @param param name:疫苗名字 enableFlag:是否可以预约 bookTip:描述
- * @return 返回状态
- */
- @Insert("insert into t_zd_covid_vaccinate (name,enable_flag,book_tip) values (#{name},#{enableFlag},#{bookTip})")
- @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
- void xinZengYiMiao(ZdCovidVaccinate param);
- /**
- * 插入对应的 疫苗的厂家
- *
- * @param param 需要插入的字段有 code主键不允许重复 vaccinateId:对应的疫苗
- * specification:规格 price:金额,name;名字,enableFlag:是否允许预约
- */
- @Insert("<script>" +
- "insert into t_covid_vaccinate_factory (code, vaccinate_id, specification, price, name,enable_flag) " +
- "values" +
- "<foreach collection='param' item='item' index='index' separator=','>" +
- " (#{item.code},#{item.vaccinateId},#{item.specification},#{item.price},#{item.name},#{item.enableFlag})" +
- "</foreach>" +
- "</script>")
- void xinZengChangJia(List<CovidVaccinateFactory> param);
- /**
- * 查询全部的疫苗名称
- *
- * @return 返回全部的数据
- */
- @Select("select * from t_zd_covid_vaccinate")
- List<ZdCovidVaccinate> chaKanYiMiao();
- /**
- * 查询全部的疫苗名称
- *
- * @param id 对应的疫苗
- * @return 对应的数据
- */
- @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 " +
- "(a.code = b.code and date = convert(char(10),getdate(),120)) where vaccinate_id=#{id}")
- List<CovidVaccinateFactory> chaKanChangJia(@Param("id") Integer id);
- /**
- * 在插入 厂家信息的时候查看 是否以及存在了
- *
- * @param dataList 多个 code
- * @return 返回 id 用来给前端查看
- */
- @Select("<script>" +
- "select vaccinate_id from t_covid_vaccinate_factory where code in " +
- "<foreach item='item' collection='dataList' open='(' separator=',' close=')'>" +
- "#{item.code}" +
- "</foreach>" +
- "</script>")
- List<Integer> changJiaCodePanDuan(@Param("dataList") List<CovidVaccinateFactory> dataList);
- /**
- * 根据id来修改 疫苗的一些字段
- *
- * @param param 修改的字段为 name enableFlag bookTip 通过id来修改
- */
- @Update("update t_zd_covid_vaccinate set name=#{name},enable_flag=#{enableFlag},book_tip=#{bookTip} where id=#{id}")
- void xiuGaiYiMiao(ZdCovidVaccinate param);
- /**
- * 根据code来修改厂家
- *
- * @param param 根据code来修改 能修改的值为
- * @return 返回boolean
- */
- @Update("update t_covid_vaccinate_factory set specification=#{specification},price=#{price}," +
- "name=#{name},enable_flag=#{enableFlag} where code =#{code}")
- void xiuGaiChangJia(CovidVaccinateFactory param);
- /**
- * 删除厂家 根据code来删除
- *
- * @param code 删除条件
- */
- @Delete("delete t_covid_vaccinate_factory where code=#{code}")
- void shanChuChangJia(@Param("code") Integer code);
- /**
- * 查看可以预约 新冠疫苗厂家的信息
- *
- * @return 返回一个list的集合
- */
- @Select("select code,a.name ,(b.name) vaccinate_name from t_covid_vaccinate_factory a inner join " +
- "t_zd_covid_vaccinate b on (a.vaccinate_id = b.id) " +
- "where a.enable_flag =1 ")
- List<CovidVaccinateFactory> kaiQiYuYueChangJia();
- /**
- * 查看厂家的code 和 日期 是否存在
- *
- * @param code 厂家的code
- * @return 返回最大值的日期
- */
- @Select("select max(date) as date from t_covid_vaccinate_threshold_new where code = #{code}")
- Date changJiaYuZhiDoesItExist(@Param("code") int code);
- /**
- * 插入每个疫苗厂家的限制阈值
- *
- * @param code 厂家的code
- * @param dateList 七天的日期
- * @param value 阈值 从一开始就获取到的
- */
- @Insert("<script>" +
- "insert into t_covid_vaccinate_threshold_new (code, date, value) values " +
- "<foreach collection='dateList' item='item' separator=','>" +
- "(#{code},#{item},#{value})" +
- "</foreach>" +
- "</script>")
- void chaRuMeiYouDeDate(@Param("code") int code,
- @Param("dateList") List<Date> dateList,
- @Param("value") int value);
- /**
- * 查看阈值
- *
- * @param code 根据产品编码
- * @param startTime 开始时间
- * @param endTime 结束时间
- * @return 返回七天数据
- */
- @Select("select * from t_covid_vaccinate_threshold_new where code=#{code} and date>=#{startTime} and date<=#{endTime} order by date")
- List<CovidVaccinateThreshold> chaKanQiTianYuZhi(@Param("code") int code,
- @Param("startTime") String startTime,
- @Param("endTime") String endTime);
- @Update("update t_covid_vaccinate_factory set enable_flag=#{enableFlag} where code = #{code}")
- void kaiQiHuoGuanBiYuYue(@Param("code") Integer code,
- @Param("enableFlag") Integer enableFlag);
- }
|