市北互联平台后端仓库
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.

178 lines
5.6 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.IcVaccineDao">
<select id="getMyNatList" resultType="com.epmet.dto.result.MyNatListResultDTO">
SELECT
id icNatId,
user_id userId,
user_type userType,
`name` `name`,
mobile mobile,
id_card idCard,
nat_time natTime,
nat_result natResult,
nat_address natAddress,
file_name fileName,
attachment_url attachmentUrl,
created_time reportTime
FROM
ic_nat
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND (
CREATED_BY = #{userId}
<if test='null != idCard and "" != idCard'>
OR id_card = #{idCard}
</if>
)
ORDER BY nat_time DESC
</select>
4 years ago
4 years ago
<select id="getIcVaccineList" resultType="com.epmet.dto.result.IcVaccineListResultDTO">
SELECT
4 years ago
a.IC_VACCINE_ID AS vaccineId,
a.agency_id,
a.user_type,
b.`name`,
b.mobile,
b.id_card,
b.INOCULATE_TIME,
b.INOCULATE_ADDRESS,
3 years ago
b.MANUFACTURER,
3 years ago
b.user_id
4 years ago
FROM ic_vaccine_relation a
INNER JOIN ic_vaccine b ON a.IC_VACCINE_ID = b.ID AND b.DEL_FLAG = '0'
WHERE a.DEL_FLAG = '0'
AND a.customer_id = #{customerId}
AND a.pids like concat('%', #{agencyId}, '%')
4 years ago
<if test='null != name and "" != name'>
AND b.name like concat('%', #{name}, '%')
</if>
<if test='null != mobile and "" != mobile'>
AND b.mobile = #{mobile}
</if>
<if test='null != idCard and "" != idCard'>
AND b.id_card = #{idCard}
</if>
<if test='null != startTime and "" != startTime'>
AND b.INOCULATE_TIME <![CDATA[ >= ]]> #{startTime}
</if>
<if test='null != endTime and "" != endTime'>
AND b.INOCULATE_TIME <![CDATA[ <= ]]> #{endTime}
</if>
3 years ago
<if test='isResiUser != null and isResiUser != ""'>
AND b.IS_RESI_USER = #{isResiUser}
</if>
4 years ago
ORDER BY b.INOCULATE_TIME DESC, b.id ASC
</select>
4 years ago
<select id="getCustomerIcVaccineList" resultType="com.epmet.dto.result.IcVaccineListResultDTO">
SELECT
4 years ago
id vaccineId,
is_resi_user isResiUser,
3 years ago
user_id userId,
user_type userType,
`name` `name`,
mobile mobile,
id_card idCard,
4 years ago
INOCULATE_TIME ,
INOCULATE_ADDRESS,
MANUFACTURER
FROM ic_vaccine
WHERE del_flag = '0'
AND customer_id = #{customerId}
<if test='null != name and "" != name'>
AND name like concat('%', #{name}, '%')
</if>
<if test='null != mobile and "" != mobile'>
AND mobile = #{mobile}
</if>
<if test='null != idCard and "" != idCard'>
AND id_card = #{idCard}
</if>
<if test='null != startTime and "" != startTime'>
AND INOCULATE_TIME <![CDATA[ >= ]]> #{startTime}
</if>
<if test='null != endTime and "" != endTime'>
AND INOCULATE_TIME <![CDATA[ <= ]]> #{endTime}
</if>
ORDER BY INOCULATE_TIME DESC, id ASC
</select>
<select id="getNatDTO" resultType="com.epmet.dto.IcNatDTO">
SELECT
id,
user_id,
user_type,
`name`,
mobile,
id_card,
nat_time,
nat_result,
nat_address
FROM
ic_nat
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND id_card = #{idCard}
AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i')
<if test='null != natResult and "" != natResult'>
AND nat_result = #{natResult}
</if>
<if test='null != icNatId and "" != icNatId'>
AND id != #{icNatId}
</if>
LIMIT 1
</select>
<select id="getVaccineDTO" resultType="com.epmet.dto.IcVaccineDTO">
SELECT
id,
is_resi_user,
user_type,
`name`,
mobile,
id_card,
is_resi_user,
inoculate_time,
inoculate_time,
manufacturer
FROM
ic_vaccine
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND id_card = #{idCard}
AND DATE_FORMAT(inoculate_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{inoculateTime}, '%Y-%m-%d %h:%i')
<if test='null != icVaccineId and "" != icVaccineId'>
AND id != #{icVaccineId}
</if>
LIMIT 1
</select>
<delete id="delById">
DELETE FROM ic_vaccine WHERE id = #{icVaccineId}
</delete>
<update id="updateIsResiFlag">
UPDATE ic_nat m,
(
SELECT if(DEL_FLAG,0,1) resiFlag, ID_CARD FROM ic_resi_user
WHERE
1=1
<if test="icResiUserId != null and icResiUserId != ''">
AND ID = #{icResiUserId}
</if>
AND CUSTOMER_ID = #{customerId}
AND DEL_FLAG = '0'
) t
SET m.IS_RESI_USER = t.resiFlag
WHERE
m.ID_CARD = t.ID_CARD
AND m.DEL_FLAG = '0'
</update>
</mapper>