236 lines
5.7 KiB
XML
236 lines
5.7 KiB
XML
<?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.hx.slj.modules.assessment.dao.SpotCheckerDao">
|
|
<sql id="spotCheckerColumns">
|
|
a.id,
|
|
a.question_id AS "questionId",
|
|
a.subtask_id AS "subtaskId",
|
|
a.gender,
|
|
a.name,
|
|
a.age,
|
|
a.type,
|
|
a.lost,
|
|
a.identityNumber,
|
|
a.nationality,
|
|
a.nirthplace,
|
|
a.phone,
|
|
a.marriage,
|
|
a.BORN_DATE AS "bornDate",
|
|
a.status,
|
|
a.remarks,
|
|
a.create_by AS "createBy.id",
|
|
a.create_date,
|
|
a.update_by AS "updateBy.id",
|
|
a.update_date,
|
|
a.del_flag,
|
|
a.answerId,
|
|
a.target_id AS "targetId",
|
|
a.sparePhone,
|
|
a.office_id AS "officeId",
|
|
a.plan_id AS "planId",
|
|
a.historyDisease AS "historyDisease"
|
|
</sql>
|
|
|
|
<select id="get" resultType="com.hx.slj.modules.assessment.entity.SpotChecker">
|
|
SELECT
|
|
<include refid="spotCheckerColumns"/>
|
|
FROM khtx_spot_checker a
|
|
WHERE a.id = #{id}
|
|
</select>
|
|
|
|
<select id="findList" resultType="com.hx.slj.modules.assessment.entity.SpotChecker">
|
|
SELECT
|
|
<include refid="spotCheckerColumns"/>
|
|
FROM khtx_spot_checker a
|
|
WHERE a.del_flag = #{DEL_FLAG_NORMAL}
|
|
<if test="type != null and type!='' ">
|
|
AND a.type = #{type}
|
|
</if>
|
|
<if test="lost != null and lost!='' ">
|
|
AND a.lost = #{lost}
|
|
</if>
|
|
<if test="subtaskId != null and subtaskId !='' ">
|
|
AND a.subtask_id = #{subtaskId}
|
|
</if>
|
|
<if test="questionId != null and questionId !='' ">
|
|
AND a.question_id = #{questionId}
|
|
</if>
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY a.create_date desc
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
<insert id="insert">
|
|
INSERT INTO khtx_spot_checker(
|
|
id,
|
|
question_id,
|
|
subtask_id,
|
|
gender,
|
|
name,
|
|
age,
|
|
type,
|
|
lost,
|
|
identityNumber,
|
|
nationality,
|
|
nirthplace,
|
|
phone,
|
|
marriage,
|
|
BORN_DATE,
|
|
status,
|
|
remarks,
|
|
create_by,
|
|
create_date,
|
|
update_by,
|
|
update_date,
|
|
del_flag,
|
|
answerId,
|
|
target_id,
|
|
sparePhone,
|
|
office_id,
|
|
plan_id,
|
|
historyDisease
|
|
) VALUES (
|
|
#{id},
|
|
#{questionId},
|
|
#{subtaskId},
|
|
#{gender},
|
|
#{name},
|
|
#{age},
|
|
#{type},
|
|
#{lost},
|
|
#{identityNumber},
|
|
#{nationality},
|
|
#{nirthplace},
|
|
#{phone},
|
|
#{marriage},
|
|
#{bornDate},
|
|
#{status},
|
|
#{remarks},
|
|
#{createBy.id},
|
|
#{createDate},
|
|
#{updateBy.id},
|
|
#{updateDate},
|
|
#{delFlag},
|
|
#{answerId},
|
|
#{targetId},
|
|
#{sparePhone},
|
|
#{officeId},
|
|
#{planId},
|
|
#{historyDisease}
|
|
)
|
|
</insert>
|
|
|
|
<update id="update">
|
|
UPDATE khtx_spot_checker SET
|
|
question_id = #{questionId},
|
|
subtask_id = #{subtaskId},
|
|
gender = #{gender},
|
|
name = #{name},
|
|
age = #{age},
|
|
type = #{type},
|
|
lost = #{lost},
|
|
identityNumber= #{identityNumber},
|
|
nationality = #{nationality},
|
|
nirthplace = #{nirthplace},
|
|
phone = #{phone},
|
|
marriage = #{marriage},
|
|
BORN_DATE = #{bornDate},
|
|
status = #{status},
|
|
remarks = #{remarks},
|
|
update_by = #{updateBy.id},
|
|
update_date = #{updateDate},
|
|
del_flag = #{delFlag},
|
|
answerId=#{answerId},
|
|
target_id= #{targetId},
|
|
sparePhone=#{sparePhone},
|
|
office_id = #{officeId},
|
|
plan_id = #{planId},
|
|
historyDisease= #{historyDisease}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<update id="delete">
|
|
DELETE FROM khtx_spot_checker WHERE id = #{id}
|
|
</update>
|
|
<!-- 返回已经调查的人员数量-->
|
|
<select id="findUserCount" resultType="java.lang.Integer" >
|
|
SELECT count(*) FROM khtx_spot_checker
|
|
where question_id = #{questionId} and subtask_id=#{subtaskId}
|
|
and del_flag=#{DEL_FLAG_NORMAL} and status = '1' and lost = '2'
|
|
</select>
|
|
<!--根据id以及状态 更新-->
|
|
<update id="updateStatusByUserId">
|
|
UPDATE khtx_spot_checker SET
|
|
lost = #{lost},
|
|
update_by = #{updateBy.id},
|
|
update_date = #{updateDate}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<select id="getByNumber" resultType="com.hx.slj.modules.assessment.entity.SpotChecker">
|
|
SELECT
|
|
<include refid="spotCheckerColumns"/>
|
|
FROM khtx_spot_checker a
|
|
WHERE a.identityNumber = #{identityNumber}
|
|
and a.subtask_id =#{subtaskId}
|
|
</select>
|
|
|
|
<!--根据调查用户身份证号以及计划id查询多问卷-->
|
|
<select id="findWJListByPlanIdAndNumber" resultType="com.hx.slj.modules.assessment.entity.SpotChecker">
|
|
SELECT
|
|
<include refid="spotCheckerColumns"/>
|
|
,
|
|
d.survey_name AS "survey.surveyName"
|
|
FROM khtx_spot_checker a
|
|
LEFT JOIN t_survey_directory d ON d.id = a.question_id
|
|
WHERE a.del_flag = #{DEL_FLAG_NORMAL}
|
|
<if test="identityNumber != null and identityNumber !='' ">
|
|
AND a.identityNumber = #{identityNumber}
|
|
</if>
|
|
<if test="planId != null and planId !='' ">
|
|
AND a.plan_id = #{planId}
|
|
</if>
|
|
group by a.question_id
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY a.create_date desc
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
<!--未失访已提交人群集合-->
|
|
<select id="findListBySubmitUser" resultType="com.hx.slj.modules.assessment.entity.SpotChecker">
|
|
SELECT
|
|
<include refid="spotCheckerColumns"/>
|
|
FROM khtx_spot_checker a
|
|
WHERE a.del_flag = #{DEL_FLAG_NORMAL}
|
|
<if test="type != null and type!='' ">
|
|
AND a.type = #{type}
|
|
</if>
|
|
<if test="lost != null and lost!='' ">
|
|
AND a.lost = #{lost}
|
|
</if>
|
|
<if test="subtaskId != null and subtaskId !='' ">
|
|
AND a.subtask_id = #{subtaskId}
|
|
</if>
|
|
<if test="questionId != null and questionId !='' ">
|
|
AND a.question_id = #{questionId}
|
|
</if>
|
|
and a.status = '1' and a.lost = '2'
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY a.create_date desc
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
</mapper> |