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

166 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,
b.MANUFACTURER
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>
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,
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>
<delete id="delById">
DELETE FROM ic_nat WHERE id = #{icNatId}
</delete>
<insert id="insertOrUpdate">
INSERT INTO epmet_user.ic_nat
(ID, CUSTOMER_ID, AGENCY_ID, PIDS, USER_ID,
USER_TYPE, NAME, MOBILE, ID_CARD, NAT_TIME, NAT_RESULT, NAT_ADDRESS, FILE_NAME, ATTACHMENT_TYPE, ATTACHMENT_URL,
DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
VALUES (#{id}, #{customerId}, #{agencyId}, #{pids}, #{userId},
#{userType}, #{name}, #{mobile}, #{idCard}, #{natTime},
#{natResult}, #{natAddress}, #{fileName}, #{attachmentType}, #{attachmentUrl},
#{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy},
#{updatedTime})
ON DUPLICATE KEY update
NAME=#{name},
MOBILE=#{mobile},
NAT_ADDRESS=#{natAddress},
NAT_RESULT=#{natResult},
UPDATED_BY=#{updatedBy},
UPDATED_TIME=NOW()
</insert>
<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>