<?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.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper">

    <resultMap type="com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO" id="SpecialDiseaseRouteResult">
        <result property="specialDiseaseRouteId" column="specialDiseaseRouteId"/>
        <result property="departmentId" column="department_id"/>
        <result property="departmentName" column="department_name"/>
        <result property="diseaseTypeId" column="disease_type_id"/>
        <result property="diseaseTypeName" column="disease_type_name"/>
        <result property="routeName" column="route_name"/>
        <result property="routeCode" column="route_code"/>
        <result property="version" column="version"/>
        <result property="routeClassify" column="route_classify"/>
        <result property="releaseStatus" column="release_status"/>
        <result property="suitRange" column="suit_range"/>
        <result property="routeSort" column="route_sort"/>
        <result property="routeRemark" column="route_remark"/>
        <result property="totalNumber" column="totalNumber"/>
        <result property="agreeNumber" column="agreeNumber"/>
        <collection property="specialDiseaseNodeList" javaType="java.util.List"
                    resultMap="SpecialDiseaseNodeVOResult"/>
    </resultMap>

    <resultMap type="SpecialDiseaseNode" id="SpecialDiseaseNodeResult">
        <result property="id" column="id"/>
        <result property="routeId" column="route_id"/>
        <result property="routeName" column="route_name"/>
        <result property="routeNodeName" column="route_node_name"/>
        <result property="routeNodeDay" column="route_node_day"/>
        <result property="taskType" column="task_type"/>
        <result property="taskSubdivision" column="task_subdivision"/>
        <result property="taskStatus" column="task_status"/>
        <result property="secondClassifyDescribe" column="second_classify_describe"/>
        <result property="executionTime" column="execution_time"/>
        <result property="templateId" column="template_id"/>
        <result property="templateName" column="template_name"/>
        <result property="templateType" column="template_type"/>
        <result property="messagePushSign" column="message_push_sign"/>
        <result property="messageTemplateId" column="message_template__id"/>
        <result property="messageTemplateName" column="message_template_name"/>
        <result property="messagePreview" column="message_preview"/>
        <result property="messageNodeContent" column="message_node_content"/>
        <result property="officialPushSign" column="official_push_sign"/>
        <result property="officialTemplateId" column="official_template_id"/>
        <result property="officialTemplateName" column="official_template_name"/>
        <result property="officialRemindContent" column="official_remind_content"/>
        <result property="officialNodeContent" column="official_node_content"/>
        <result property="appletPushSign" column="applet_push_sign"/>
        <result property="appletTemplateId" column="applet_template_id"/>
        <result property="appletTemplateName" column="applet_template_name"/>
        <result property="appletRemindContent" column="applet_remind_content"/>
        <result property="appletPromptDescription" column="applet_prompt_description"/>
        <result property="appletNodeContent" column="applet_node_content"/>
        <result property="phonePushSign" column="phone_push_sign"/>
        <result property="phoneTemplateId" column="phone_template_id"/>
        <result property="phoneTemplateName" column="phone_template_name"/>
        <result property="phoneMessageRemind" column="phone_message_remind"/>
        <result property="phoneMessageTemplateId" column="phone_message_template_id"/>
        <result property="phoneMessageTemplateName" column="phone_message_template_name"/>
        <result property="phoneAgencyName" column="phone_agency_name"/>
        <result property="phoneNodeContent" column="phone_node_content"/>
        <result property="routeCheckStatus" column="route_check_status"/>
        <result property="routeCheckPerson" column="route_check_person"/>
        <result property="routeCheckDate" column="route_check_date"/>
        <result property="routeCheckRemark" column="route_check_remark"/>
        <result property="nodeContent" column="node_content"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <resultMap type="com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO" id="SpecialDiseaseNodeVOResult">
        <result property="specialDiseaseNodeId" column="specialDiseaseNodeId"/>
        <result property="routeId" column="route_id"/>
        <result property="routeName" column="route_name"/>
        <result property="routeNodeName" column="route_node_name"/>
        <result property="routeNodeDay" column="route_node_day"/>
        <result property="taskType" column="task_type"/>
        <result property="taskSubdivision" column="task_subdivision"/>
        <result property="taskType" column="taskSubdivisionName"/>
        <result property="taskSubdivision" column="taskSubdivisionName"/>
        <result property="taskStatus" column="task_status"/>
        <result property="secondClassifyDescribe" column="second_classify_describe"/>
        <result property="executionTime" column="execution_time"/>
        <result property="templateId" column="template_id"/>
        <result property="templateName" column="template_name"/>
        <result property="templateType" column="template_type"/>
        <result property="messagePushSign" column="message_push_sign"/>
        <result property="messageTemplateId" column="message_template__id"/>
        <result property="messageTemplateName" column="message_template_name"/>
        <result property="messagePreview" column="message_preview"/>
        <result property="messageNodeContent" column="message_node_content"/>
        <result property="officialPushSign" column="official_push_sign"/>
        <result property="officialTemplateId" column="official_template_id"/>
        <result property="officialTemplateName" column="official_template_name"/>
        <result property="officialRemindContent" column="official_remind_content"/>
        <result property="officialNodeContent" column="official_node_content"/>
        <result property="appletPushSign" column="applet_push_sign"/>
        <result property="appletTemplateId" column="applet_template_id"/>
        <result property="appletTemplateName" column="applet_template_name"/>
        <result property="appletRemindContent" column="applet_remind_content"/>
        <result property="appletPromptDescription" column="applet_prompt_description"/>
        <result property="appletNodeContent" column="applet_node_content"/>
        <result property="phonePushSign" column="phone_push_sign"/>
        <result property="phoneTemplateId" column="phone_template_id"/>
        <result property="phoneTemplateName" column="phone_template_name"/>
        <result property="phoneMessageRemind" column="phone_message_remind"/>
        <result property="phoneMessageTemplateId" column="phone_message_template_id"/>
        <result property="phoneMessageTemplateName" column="phone_message_template_name"/>
        <result property="phoneAgencyName" column="phone_agency_name"/>
        <result property="phoneNodeContent" column="phone_node_content"/>
        <result property="routeCheckStatus" column="route_check_status"/>
        <result property="routeCheckPerson" column="route_check_person"/>
        <result property="routeCheckDate" column="route_check_date"/>
        <result property="routeCheckRemark" column="route_check_remark"/>
        <result property="nodeContent" column="node_content"/>
    </resultMap>

    <sql id="selectSpecialDiseaseNodeVo">
        select id,
               route_id,
               route_name,
               route_node_name,
               route_node_day,
               task_type,
               task_subdivision,
               task_status,
               second_classify_describe,
               execution_time,
               template_id,
               template_name,
               template_type,
               message_push_sign,
               message_template__id,
               message_template_name,
               message_preview,
               message_node_content,
               official_push_sign,
               official_template_id,
               official_template_name,
               official_remind_content,
               official_node_content,
               applet_push_sign,
               applet_template_id,
               applet_template_name,
               applet_remind_content,
               applet_prompt_description,
               applet_node_content,
               phone_push_sign,
               phone_template_id,
               phone_template_name,
               phone_message_remind,
               phone_message_template_id,
               phone_message_template_name,
               phone_agency_name,
               phone_node_content,
               route_check_status,
               route_check_person,
               route_check_date,
               route_check_remark,
               node_content,
               create_by,
               create_time,
               update_by,
               update_time
        from special_disease_node
    </sql>

    <select id="selectSpecialDiseaseNodeList" parameterType="SpecialDiseaseNode" resultMap="SpecialDiseaseNodeResult">
        <include refid="selectSpecialDiseaseNodeVo"/>
        <where>
            <if test="routeId != null ">
                and route_id = #{routeId}
            </if>
            <if test="routeName != null  and routeName != ''">
                and route_name like concat('%', #{routeName}, '%')
            </if>
            <if test="routeNodeName != null  and routeNodeName != ''">
                and route_node_name like concat('%', #{routeNodeName}, '%')
            </if>
            <if test="routeNodeDay != null ">
                and route_node_day = #{routeNodeDay}
            </if>
            <if test="taskType != null  and taskType != ''">
                and task_type = #{taskType}
            </if>
            <if test="taskSubdivision != null  and taskSubdivision != ''">
                and task_subdivision = #{taskSubdivision}
            </if>
            <if test="taskStatus != null  and taskStatus != ''">
                and task_status = #{taskStatus}
            </if>
            <if test="secondClassifyDescribe != null  and secondClassifyDescribe != ''">
                and second_classify_describe = #{secondClassifyDescribe}
            </if>
            <if test="executionTime != null ">
                and execution_time = #{executionTime}
            </if>
            <if test="templateId != null ">
                and template_id = #{templateId}
            </if>
            <if test="templateName != null  and templateName != ''">
                and template_name like concat('%', #{templateName}, '%')
            </if>
            <if test="templateType != null  and templateType != ''">
                and template_type = #{templateType}
            </if>
            <if test="messagePushSign != null ">
                and message_push_sign = #{messagePushSign}
            </if>
            <if test="messageTemplateId != null ">
                and message_template__id = #{messageTemplateId}
            </if>
            <if test="messageTemplateName != null  and messageTemplateName != ''">
                and message_template_name like concat('%', #{messageTemplateName}, '%')
            </if>
            <if test="messagePreview != null  and messagePreview != ''">
                and message_preview = #{messagePreview}
            </if>
            <if test="messageNodeContent != null  and messageNodeContent != ''">
                and message_node_content = #{messageNodeContent}
            </if>
            <if test="officialPushSign != null ">
                and official_push_sign = #{officialPushSign}
            </if>
            <if test="officialTemplateId != null ">
                and official_template_id = #{officialTemplateId}
            </if>
            <if test="officialTemplateName != null  and officialTemplateName != ''">
                and official_template_name like concat('%', #{officialTemplateName}, '%')
            </if>
            <if test="officialRemindContent != null  and officialRemindContent != ''">
                and official_remind_content = #{officialRemindContent}
            </if>
            <if test="officialNodeContent != null  and officialNodeContent != ''">
                and official_node_content = #{officialNodeContent}
            </if>
            <if test="appletPushSign != null ">
                and applet_push_sign = #{appletPushSign}
            </if>
            <if test="appletTemplateId != null ">
                and applet_template_id = #{appletTemplateId}
            </if>
            <if test="appletTemplateName != null  and appletTemplateName != ''">
                and applet_template_name like concat('%', #{appletTemplateName}, '%')
            </if>
            <if test="appletRemindContent != null  and appletRemindContent != ''">
                and applet_remind_content = #{appletRemindContent}
            </if>
            <if test="appletPromptDescription != null  and appletPromptDescription != ''">
                and applet_prompt_description = #{appletPromptDescription}
            </if>
            <if test="appletNodeContent != null  and appletNodeContent != ''">
                and applet_node_content = #{appletNodeContent}
            </if>
            <if test="phonePushSign != null ">
                and phone_push_sign = #{phonePushSign}
            </if>
            <if test="phoneTemplateId != null ">
                and phone_template_id = #{phoneTemplateId}
            </if>
            <if test="phoneTemplateName != null  and phoneTemplateName != ''">
                and phone_template_name like concat('%', #{phoneTemplateName}, '%')
            </if>
            <if test="phoneMessageRemind != null  and phoneMessageRemind != ''">
                and phone_message_remind = #{phoneMessageRemind}
            </if>
            <if test="phoneMessageTemplateId != null ">
                and phone_message_template_id = #{phoneMessageTemplateId}
            </if>
            <if test="phoneMessageTemplateName != null  and phoneMessageTemplateName != ''">
                and phone_message_template_name like concat('%', #{phoneMessageTemplateName}, '%')
            </if>
            <if test="phoneAgencyName != null  and phoneAgencyName != ''">
                and phone_agency_name like concat('%', #{phoneAgencyName}, '%')
            </if>
            <if test="phoneNodeContent != null  and phoneNodeContent != ''">
                and phone_node_content = #{phoneNodeContent}
            </if>
            <if test="routeCheckStatus != null  and routeCheckStatus != ''">
                and route_check_status = #{routeCheckStatus}
            </if>
            <if test="routeCheckPerson != null  and routeCheckPerson != ''">
                and route_check_person = #{routeCheckPerson}
            </if>
            <if test="routeCheckDate != null ">
                and route_check_date = #{routeCheckDate}
            </if>
            <if test="routeCheckRemark != null  and routeCheckRemark != ''">
                and route_check_remark = #{routeCheckRemark}
            </if>
            <if test="nodeContent != null  and nodeContent != ''">
                and node_content = #{nodeContent}
            </if>
        </where>
    </select>

    <select id="selectSpecialDiseaseNodeById" parameterType="Long"
            resultMap="SpecialDiseaseNodeResult">
        <include refid="selectSpecialDiseaseNodeVo"/>
        where id = #{id}
    </select>

    <insert id="insertSpecialDiseaseNode" parameterType="SpecialDiseaseNode" useGeneratedKeys="true"
            keyProperty="id">
        insert into special_disease_node
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="routeId != null">route_id,
            </if>
            <if test="routeName != null">route_name,
            </if>
            <if test="routeNodeName != null">route_node_name,
            </if>
            <if test="routeNodeDay != null">route_node_day,
            </if>
            <if test="taskType != null">task_type,
            </if>
            <if test="taskSubdivision != null">task_subdivision,
            </if>
            <if test="taskStatus != null">task_status,
            </if>
            <if test="secondClassifyDescribe != null">second_classify_describe,
            </if>
            <if test="executionTime != null">execution_time,
            </if>
            <if test="templateId != null">template_id,
            </if>
            <if test="templateName != null">template_name,
            </if>
            <if test="templateType != null">template_type,
            </if>
            <if test="messagePushSign != null">message_push_sign,
            </if>
            <if test="messageTemplateId != null">message_template__id,
            </if>
            <if test="messageTemplateName != null">message_template_name,
            </if>
            <if test="messagePreview != null">message_preview,
            </if>
            <if test="messageNodeContent != null">message_node_content,
            </if>
            <if test="officialPushSign != null">official_push_sign,
            </if>
            <if test="officialTemplateId != null">official_template_id,
            </if>
            <if test="officialTemplateName != null">official_template_name,
            </if>
            <if test="officialRemindContent != null">official_remind_content,
            </if>
            <if test="officialNodeContent != null">official_node_content,
            </if>
            <if test="appletPushSign != null">applet_push_sign,
            </if>
            <if test="appletTemplateId != null">applet_template_id,
            </if>
            <if test="appletTemplateName != null">applet_template_name,
            </if>
            <if test="appletRemindContent != null">applet_remind_content,
            </if>
            <if test="appletPromptDescription != null">applet_prompt_description,
            </if>
            <if test="appletNodeContent != null">applet_node_content,
            </if>
            <if test="phonePushSign != null">phone_push_sign,
            </if>
            <if test="phoneTemplateId != null">phone_template_id,
            </if>
            <if test="phoneTemplateName != null">phone_template_name,
            </if>
            <if test="phoneMessageRemind != null">phone_message_remind,
            </if>
            <if test="phoneMessageTemplateId != null">phone_message_template_id,
            </if>
            <if test="phoneMessageTemplateName != null">phone_message_template_name,
            </if>
            <if test="phoneAgencyName != null">phone_agency_name,
            </if>
            <if test="phoneNodeContent != null">phone_node_content,
            </if>
            <if test="routeCheckStatus != null">route_check_status,
            </if>
            <if test="routeCheckPerson != null">route_check_person,
            </if>
            <if test="routeCheckDate != null">route_check_date,
            </if>
            <if test="routeCheckRemark != null">route_check_remark,
            </if>
            <if test="createBy != null">create_by,
            </if>
            <if test="createTime != null">create_time,
            </if>
            <if test="updateBy != null">update_by,
            </if>
            <if test="updateTime != null">update_time,
            </if>
            <if test="nodeContent != null">node_content,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="routeId != null">#{routeId},
            </if>
            <if test="routeName != null">#{routeName},
            </if>
            <if test="routeNodeName != null">#{routeNodeName},
            </if>
            <if test="routeNodeDay != null">#{routeNodeDay},
            </if>
            <if test="taskType != null">#{taskType},
            </if>
            <if test="taskSubdivision != null">#{taskSubdivision},
            </if>
            <if test="taskStatus != null">#{taskStatus},
            </if>
            <if test="secondClassifyDescribe != null">#{secondClassifyDescribe},
            </if>
            <if test="executionTime != null">#{executionTime},
            </if>
            <if test="templateId != null">#{templateId},
            </if>
            <if test="templateName != null">#{templateName},
            </if>
            <if test="templateType != null">#{templateType},
            </if>
            <if test="messagePushSign != null">#{messagePushSign},
            </if>
            <if test="messageTemplateId != null">#{messageTemplateId},
            </if>
            <if test="messageTemplateName != null">#{messageTemplateName},
            </if>
            <if test="messagePreview != null">#{messagePreview},
            </if>
            <if test="messageNodeContent != null">#{messageNodeContent},
            </if>
            <if test="officialPushSign != null">#{officialPushSign},
            </if>
            <if test="officialTemplateId != null">#{officialTemplateId},
            </if>
            <if test="officialTemplateName != null">#{officialTemplateName},
            </if>
            <if test="officialRemindContent != null">#{officialRemindContent},
            </if>
            <if test="officialNodeContent != null">#{officialNodeContent},
            </if>
            <if test="appletPushSign != null">#{appletPushSign},
            </if>
            <if test="appletTemplateId != null">#{appletTemplateId},
            </if>
            <if test="appletTemplateName != null">#{appletTemplateName},
            </if>
            <if test="appletRemindContent != null">#{appletRemindContent},
            </if>
            <if test="appletPromptDescription != null">#{appletPromptDescription},
            </if>
            <if test="appletNodeContent != null">#{appletNodeContent},
            </if>
            <if test="phonePushSign != null">#{phonePushSign},
            </if>
            <if test="phoneTemplateId != null">#{phoneTemplateId},
            </if>
            <if test="phoneTemplateName != null">#{phoneTemplateName},
            </if>
            <if test="phoneMessageRemind != null">#{phoneMessageRemind},
            </if>
            <if test="phoneMessageTemplateId != null">#{phoneMessageTemplateId},
            </if>
            <if test="phoneMessageTemplateName != null">#{phoneMessageTemplateName},
            </if>
            <if test="phoneAgencyName != null">#{phoneAgencyName},
            </if>
            <if test="phoneNodeContent != null">#{phoneNodeContent},
            </if>
            <if test="routeCheckStatus != null">#{routeCheckStatus},
            </if>
            <if test="routeCheckPerson != null">#{routeCheckPerson},
            </if>
            <if test="routeCheckDate != null">#{routeCheckDate},
            </if>
            <if test="routeCheckRemark != null">#{routeCheckRemark},
            </if>
            <if test="createBy != null">#{createBy},
            </if>
            <if test="createTime != null">#{createTime},
            </if>
            <if test="updateBy != null">#{updateBy},
            </if>
            <if test="updateTime != null">#{updateTime},
            </if>
            <if test="nodeContent != null">#{nodeContent},
            </if>
        </trim>
    </insert>

    <update id="updateSpecialDiseaseNode" parameterType="SpecialDiseaseNode">
        update special_disease_node
        <trim prefix="SET" suffixOverrides=",">
            <if test="routeId != null">route_id =
                #{routeId},
            </if>
            <if test="routeName != null">route_name =
                #{routeName},
            </if>
            <if test="routeNodeName != null">route_node_name =
                #{routeNodeName},
            </if>
            <if test="routeNodeDay != null">route_node_day =
                #{routeNodeDay},
            </if>
            <if test="taskType != null">task_type =
                #{taskType},
            </if>
            <if test="taskSubdivision != null">task_subdivision =
                #{taskSubdivision},
            </if>
            <if test="taskStatus != null">task_status =
                #{taskStatus},
            </if>
            <if test="secondClassifyDescribe != null">second_classify_describe =
                #{secondClassifyDescribe},
            </if>
            <if test="executionTime != null">execution_time =
                #{executionTime},
            </if>
            <if test="templateId != null">template_id =
                #{templateId},
            </if>
            <if test="templateName != null">template_name =
                #{templateName},
            </if>
            <if test="templateType != null">template_type =
                #{templateType},
            </if>
            <if test="messagePushSign != null">message_push_sign =
                #{messagePushSign},
            </if>
            <if test="messageTemplateId != null">message_template__id =
                #{messageTemplateId},
            </if>
            <if test="messageTemplateName != null">message_template_name =
                #{messageTemplateName},
            </if>
            <if test="messagePreview != null">message_preview =
                #{messagePreview},
            </if>
            <if test="messageNodeContent != null">message_node_content =
                #{messageNodeContent},
            </if>
            <if test="officialPushSign != null">official_push_sign =
                #{officialPushSign},
            </if>
            <if test="officialTemplateId != null">official_template_id =
                #{officialTemplateId},
            </if>
            <if test="officialTemplateName != null">official_template_name =
                #{officialTemplateName},
            </if>
            <if test="officialRemindContent != null">official_remind_content =
                #{officialRemindContent},
            </if>
            <if test="officialNodeContent != null">official_node_content =
                #{officialNodeContent},
            </if>
            <if test="appletPushSign != null">applet_push_sign =
                #{appletPushSign},
            </if>
            <if test="appletTemplateId != null">applet_template_id =
                #{appletTemplateId},
            </if>
            <if test="appletTemplateName != null">applet_template_name =
                #{appletTemplateName},
            </if>
            <if test="appletRemindContent != null">applet_remind_content =
                #{appletRemindContent},
            </if>
            <if test="appletPromptDescription != null">applet_prompt_description =
                #{appletPromptDescription},
            </if>
            <if test="appletNodeContent != null">applet_node_content =
                #{appletNodeContent},
            </if>
            <if test="phonePushSign != null">phone_push_sign =
                #{phonePushSign},
            </if>
            <if test="phoneTemplateId != null">phone_template_id =
                #{phoneTemplateId},
            </if>
            <if test="phoneTemplateName != null">phone_template_name =
                #{phoneTemplateName},
            </if>
            <if test="phoneMessageRemind != null">phone_message_remind =
                #{phoneMessageRemind},
            </if>
            <if test="phoneMessageTemplateId != null">phone_message_template_id =
                #{phoneMessageTemplateId},
            </if>
            <if test="phoneMessageTemplateName != null">phone_message_template_name =
                #{phoneMessageTemplateName},
            </if>
            <if test="phoneAgencyName != null">phone_agency_name =
                #{phoneAgencyName},
            </if>
            <if test="phoneNodeContent != null">phone_node_content =
                #{phoneNodeContent},
            </if>
            <if test="routeCheckStatus != null">route_check_status =
                #{routeCheckStatus},
            </if>
            <if test="routeCheckPerson != null">route_check_person =
                #{routeCheckPerson},
            </if>
            <if test="routeCheckDate != null">route_check_date =
                #{routeCheckDate},
            </if>
            <if test="routeCheckRemark != null">route_check_remark =
                #{routeCheckRemark},
            </if>
            <if test="createBy != null">create_by =
                #{createBy},
            </if>
            <if test="createTime != null">create_time =
                #{createTime},
            </if>
            <if test="updateBy != null">update_by =
                #{updateBy},
            </if>
            <if test="updateTime != null">update_time =
                #{updateTime},
            </if>
            <if test="nodeContent != null">node_content =
                #{nodeContent},
            </if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSpecialDiseaseNodeById" parameterType="Long">
        delete
        from special_disease_node
        where id = #{id}
    </delete>

    <delete id="deleteSpecialDiseaseNodeByIds" parameterType="String">
        delete from special_disease_node where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <insert id="insertSpecialDiseaseNodeList">
        insert into special_disease_node(
        route_id,
        route_name,
        route_node_name,
        route_node_day,
        task_type,
        task_subdivision,
        task_status,
        second_classify_describe,
        execution_time,
        template_id,
        template_name,
        template_type,
        message_push_sign,
        message_template__id,
        message_template_name,
        message_preview,
        message_node_content,
        official_push_sign,
        official_template_id,
        official_template_name,
        official_remind_content,
        official_node_content,
        applet_push_sign,
        applet_template_id,
        applet_template_name,
        applet_remind_content,
        applet_prompt_description,
        applet_node_content,
        phone_push_sign,
        phone_template_id,
        phone_template_name,
        phone_message_remind,
        phone_message_template_id,
        phone_message_template_name,
        phone_agency_name,
        phone_node_content,
        route_check_status,
        route_check_person,
        route_check_date,
        route_check_remark,
        node_content,
        create_by,
        create_time
        ) values
        <foreach item="specialDiseaseNodeList" index="index" collection="list" separator=",">
            (
            #{specialDiseaseNodeList.routeId},
            #{specialDiseaseNodeList.routeName},
            #{specialDiseaseNodeList.routeNodeName},
            #{specialDiseaseNodeList.routeNodeDay},
            #{specialDiseaseNodeList.taskType},
            #{specialDiseaseNodeList.taskSubdivision},
            #{specialDiseaseNodeList.taskStatus},
            #{specialDiseaseNodeList.secondClassifyDescribe},
            #{specialDiseaseNodeList.executionTime},
            #{specialDiseaseNodeList.templateId},
            #{specialDiseaseNodeList.templateName},
            #{specialDiseaseNodeList.templateType},
            #{specialDiseaseNodeList.messagePushSign},
            #{specialDiseaseNodeList.messageTemplateId},
            #{specialDiseaseNodeList.messageTemplateName},
            #{specialDiseaseNodeList.messagePreview},
            #{specialDiseaseNodeList.messageNodeContent},
            #{specialDiseaseNodeList.officialPushSign},
            #{specialDiseaseNodeList.officialTemplateId},
            #{specialDiseaseNodeList.officialTemplateName},
            #{specialDiseaseNodeList.officialRemindContent},
            #{specialDiseaseNodeList.officialNodeContent},
            #{specialDiseaseNodeList.appletPushSign},
            #{specialDiseaseNodeList.appletTemplateId},
            #{specialDiseaseNodeList.appletTemplateName},
            #{specialDiseaseNodeList.appletRemindContent},
            #{specialDiseaseNodeList.appletPromptDescription},
            #{specialDiseaseNodeList.appletNodeContent},
            #{specialDiseaseNodeList.phonePushSign},
            #{specialDiseaseNodeList.phoneTemplateId},
            #{specialDiseaseNodeList.phoneTemplateName},
            #{specialDiseaseNodeList.phoneMessageRemind},
            #{specialDiseaseNodeList.phoneMessageTemplateId},
            #{specialDiseaseNodeList.phoneMessageTemplateName},
            #{specialDiseaseNodeList.phoneAgencyName},
            #{specialDiseaseNodeList.phoneNodeContent},
            #{specialDiseaseNodeList.routeCheckStatus},
            #{specialDiseaseNodeList.routeCheckPerson},
            #{specialDiseaseNodeList.routeCheckDate},
            #{specialDiseaseNodeList.routeCheckRemark},
            #{specialDiseaseNodeList.nodeContent},
            #{specialDiseaseNodeList.createBy},
            #{specialDiseaseNodeList.createTime}
            )
        </foreach>
    </insert>

    <delete id="deleteSpecialDiseaseNodeByRouteId">
        delete
        from special_disease_node
        where route_id = #{routeId}
    </delete>

    <select id="selectSpecialDiseaseByRouteId"
            resultType="com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO"
            resultMap="SpecialDiseaseRouteResult">
        select sdr.id               specialDiseaseRouteId,
               sdr.department_id,
               sdr.department_name,
               sdr.disease_type_id,
               sdr.disease_type_name,
               sdr.route_name,
               sdr.route_code,
               sdr.version,
               sdr.route_classify,
               sdr.release_status,
               sdr.suit_range,
               sdn.id as            specialDiseaseNodeId,
               sdn.route_id,
               sdn.route_name,
               sdn.route_node_name,
               sdn.route_node_day,
               sdn.task_type,
               sdn.task_subdivision,
               sdn.task_type        taskTypeName,
               sdn.task_subdivision taskSubdivisionName,
               sdn.task_status,
               sdn.second_classify_describe,
               sdn.execution_time,
               sdn.template_id,
               sdn.template_name,
               sdn.template_type,
               sdn.message_push_sign,
               sdn.message_template__id,
               sdn.message_template_name,
               sdn.message_preview,
               sdn.message_node_content,
               sdn.official_push_sign,
               sdn.official_template_id,
               sdn.official_template_name,
               sdn.official_remind_content,
               sdn.official_node_content,
               sdn.applet_push_sign,
               sdn.applet_template_id,
               sdn.applet_template_name,
               sdn.applet_remind_content,
               sdn.applet_prompt_description,
               sdn.applet_node_content,
               sdn.phone_push_sign,
               sdn.phone_template_id,
               sdn.phone_template_name,
               sdn.phone_message_remind,
               sdn.phone_message_template_id,
               sdn.phone_message_template_name,
               sdn.phone_agency_name,
               sdn.phone_node_content,
               sdn.route_check_status,
               sdn.route_check_person,
               sdn.route_check_date,
               sdn.route_check_remark,
               sdn.node_content,
               (select COUNT(1)
                from special_disease_node
                where route_id = specialDiseaseRouteId) totalNumber,
               (select COUNT(1)
                from special_disease_node
                where route_id = specialDiseaseRouteId
                  and route_check_status = 'AGREE')     agreeNumber
        from special_disease_route sdr
                 left join special_disease_node sdn ON sdn.route_id = sdr.id
        where sdr.id = #{specialDiseaseRouteId}
    </select>
</mapper>