市北互联平台后端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
4.2 KiB

4 years ago
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcEpidemicSpecialAttentionDao">
4 years ago
<!-- 取消关注 -->
<update id="cancelAttention">
UPDATE ic_epidemic_special_attention
SET UPDATED_TIME = NOW(),
4 years ago
IS_ATTENTION = 0,
del_flag = 1
4 years ago
WHERE del_flag = 0
AND attention_type = #{attentionType}
AND id_card IN (
<foreach collection="list" item="l" separator=",">
#{l}
</foreach>
)
</update>
4 years ago
<!-- 疫苗接种关注名单 -->
<select id="vaccinationList" resultType="com.epmet.dto.result.VaccinationListResultDTO">
SELECT
a.`NAME`,
a.MOBILE,
a.ID_CARD,
a.REMARK,
4 years ago
IFNULL((SELECT DATE_FORMAT(CREATED_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_notice WHERE DEL_FLAG = '0' AND ORIGIN = #{attentionType} AND ID_CARD = a.ID_CARD ORDER BY CREATED_TIME DESC LIMIT 1),'') AS lastInformTime,
4 years ago
IFNULL(v.vaccinationCount,0) AS vaccinationCount
4 years ago
FROM ic_epidemic_special_attention a
LEFT JOIN (SELECT id_card ,count(1) AS vaccinationCount FROM ic_vaccine WHERE DEL_FLAG = 0 GROUP BY ID_CARD) v ON (v.ID_CARD = a.ID_CARD)
4 years ago
WHERE a.DEL_FLAG = 0
AND a.ORG_ID = #{orgId}
AND ATTENTION_TYPE = #{attentionType}
<if test='null != name and "" != name'>
AND a.`NAME` LIKE CONCAT('%',#{name},'%')
4 years ago
</if>
<if test='null != mobile and "" != mobile'>
AND a.MOBILE LIKE CONCAT('%',#{mobile},'%')
4 years ago
</if>
<if test='null != mobile and "" != mobile'>
AND a.ID_CARD LIKE CONCAT('%',#{idCard},'%')
4 years ago
</if>
<if test=' null != vaccinationCount'>
HAVING vaccinationCount = #{vaccinationCount}
</if>
ORDER BY a.CREATED_TIME DESC
</select>
<!-- 核酸检测关注名单 -->
<select id="natList" resultType="com.epmet.dto.result.VaccinationListResultDTO">
SELECT
a.`NAME`,
a.MOBILE,
a.ID_CARD,
a.REMARK,
a.REASON,
4 years ago
IFNULL((SELECT DATE_FORMAT(CREATED_TIME,'%Y-%m-%d %H:%i:%s') FROM ic_notice WHERE DEL_FLAG = '0' AND ORIGIN = #{attentionType} AND ID_CARD = a.ID_CARD ORDER BY CREATED_TIME DESC LIMIT 1),'') AS lastInformTime
4 years ago
FROM ic_epidemic_special_attention a
WHERE a.DEL_FLAG = 0
AND a.ORG_ID = #{orgId}
AND ATTENTION_TYPE = #{attentionType}
<if test='null != name and "" != name'>
AND a.`NAME` LIKE CONCAT('%',#{name},'%')
4 years ago
</if>
<if test='null != mobile and "" != mobile'>
AND a.MOBILE LIKE CONCAT('%',#{mobile},'%')
4 years ago
</if>
<if test='null != mobile and "" != mobile'>
AND a.ID_CARD LIKE CONCAT('%',#{idCard},'%')
4 years ago
</if>
<if test='null != reason and "" != reason'>
AND a.REASON LIKE CONCAT('%',#{reason},'%')
</if>
<if test='null != remark and "" != remark'>
AND a.REMARK LIKE CONCAT('%',#{remark},'%')
</if>
ORDER BY a.CREATED_TIME DESC
</select>
4 years ago
4 years ago
<!-- 查询已经存在的关注 -->
<select id="getExistList" resultType="java.lang.String">
SELECT
ID_CARD
FROM ic_epidemic_special_attention
WHERE DEL_FLAG = 0
AND ATTENTION_TYPE = #{attentionType}
AND ID_CARD IN (
<foreach collection="list" item="l" separator=",">
#{l}
</foreach>
)
</select>
<select id="getIdCardList" parameterType="map" resultType="java.lang.String">
SELECT
DISTINCT
ID_CARD
FROM
ic_epidemic_special_attention
WHERE
DEL_FLAG = 0
AND IS_ATTENTION = '1'
AND ATTENTION_TYPE = #{attentionType}
AND CUSTOMER_ID=#{customerId}
AND ID_CARD IN (
<foreach collection="idCardSet" item="idCard" separator=",">
#{idCard}
</foreach>
)
</select>
</mapper>