<?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.projectlastresult.ProjectLastResultMapper">

    <resultMap id="BaseResultMap" type="com.xinelu.manage.domain.projectlastresult.ProjectLastResult">
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result property="patientId" column="patient_id" jdbcType="BIGINT"/>
        <result property="patientName" column="patient_name" jdbcType="VARCHAR"/>
        <result property="cardNo" column="card_no" jdbcType="VARCHAR"/>
        <result property="batchId" column="batch_id" jdbcType="BIGINT"/>
        <result property="batchName" column="batch_name" jdbcType="VARCHAR"/>
        <result property="groupId" column="group_id" jdbcType="BIGINT"/>
        <result property="groupName" column="group_name" jdbcType="VARCHAR"/>
        <result property="projectId" column="project_id" jdbcType="BIGINT"/>
        <result property="projectName" column="project_name" jdbcType="VARCHAR"/>
        <result property="deviceId" column="device_id" jdbcType="BIGINT"/>
        <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
        <result property="projectAlias" column="project_alias" jdbcType="VARCHAR"/>
        <result property="judgeMode" column="judge_mode" jdbcType="VARCHAR"/>
        <result property="measureResult" column="measure_result" jdbcType="VARCHAR"/>
        <result property="maxValue" column="max_value" jdbcType="INTEGER"/>
        <result property="minValue" column="min_value" jdbcType="INTEGER"/>
        <result property="defaultValue" column="default_value" jdbcType="VARCHAR"/>
        <result property="lisCompare" column="lis_compare" jdbcType="VARCHAR"/>
        <result property="measureTime" column="measure_time" jdbcType="TIMESTAMP"/>
        <result property="measureName" column="measure_name" jdbcType="VARCHAR"/>
        <result property="recordRemark" column="record_remark" jdbcType="VARCHAR"/>
        <result property="qualifiedSign" column="qualified_sign" jdbcType="VARCHAR"/>
	    <result property="measureResultPath" column="measure_result_path"/>
	    <result property="projectUnit" column="project_unit"/>
        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,patient_id,patient_name,
        card_no,batch_id,batch_name,
        group_id,group_name,project_id,
        project_name,device_id,device_name,
        project_alias,judge_mode,measure_result,
        max_value,min_value,default_value,
        lis_compare,measure_time,measure_name,
        record_remark,qualified_sign,measure_result_path,project_unit,create_by,
        create_time,update_by,update_time
    </sql>

    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from project_last_result
        where  id = #{id,jdbcType=BIGINT} 
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from project_last_result
        where  id = #{id,jdbcType=BIGINT} 
    </delete>
    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.projectlastresult.ProjectLastResult" useGeneratedKeys="true">
        insert into project_last_result
        ( id,patient_id,patient_name
        ,card_no,batch_id,batch_name
        ,group_id,group_name,project_id
        ,project_name,device_id,device_name
        ,project_alias,judge_mode,measure_result
        ,max_value,min_value,default_value
        ,lis_compare,measure_time,measure_name
        ,record_remark,qualified_sign,measure_result_path,project_unit
        ,create_by,create_time,update_by,update_time
        )
        values (#{id,jdbcType=BIGINT},#{patientId,jdbcType=BIGINT},#{patientName,jdbcType=VARCHAR}
        ,#{cardNo,jdbcType=VARCHAR},#{batchId,jdbcType=BIGINT},#{batchName,jdbcType=VARCHAR}
        ,#{groupId,jdbcType=BIGINT},#{groupName,jdbcType=VARCHAR},#{projectId,jdbcType=BIGINT}
        ,#{projectName,jdbcType=VARCHAR},#{deviceId,jdbcType=BIGINT},#{deviceName,jdbcType=VARCHAR}
        ,#{projectAlias,jdbcType=VARCHAR},#{judgeMode,jdbcType=VARCHAR},#{measureResult,jdbcType=VARCHAR}
        ,#{maxValue,jdbcType=INTEGER},#{minValue,jdbcType=INTEGER},#{defaultValue,jdbcType=VARCHAR}
        ,#{lisCompare,jdbcType=VARCHAR},#{measureTime,jdbcType=TIMESTAMP},#{measureName,jdbcType=VARCHAR}
        ,#{recordRemark,jdbcType=VARCHAR},#{qualifiedSign,jdbcType=VARCHAR}
        ,#{measureResultPath,jdbcType=VARCHAR},#{projectUnit,jdbcType=VARCHAR}
        ,#{createBy,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateBy,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP}
        )
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.projectlastresult.ProjectLastResult" useGeneratedKeys="true">
        insert into project_last_result
        <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="id != null">id,</if>
                <if test="patientId != null">patient_id,</if>
                <if test="patientName != null">patient_name,</if>
                <if test="cardNo != null">card_no,</if>
                <if test="batchId != null">batch_id,</if>
                <if test="batchName != null">batch_name,</if>
                <if test="groupId != null">group_id,</if>
                <if test="groupName != null">group_name,</if>
                <if test="projectId != null">project_id,</if>
                <if test="projectName != null">project_name,</if>
                <if test="deviceId != null">device_id,</if>
                <if test="deviceName != null">device_name,</if>
                <if test="projectAlias != null">project_alias,</if>
                <if test="judgeMode != null">judge_mode,</if>
                <if test="measureResult != null">measure_result,</if>
                <if test="maxValue != null">max_value,</if>
                <if test="minValue != null">min_value,</if>
                <if test="defaultValue != null">default_value,</if>
                <if test="lisCompare != null">lis_compare,</if>
                <if test="measureTime != null">measure_time,</if>
                <if test="measureName != null">measure_name,</if>
                <if test="recordRemark != null">record_remark,</if>
                <if test="qualifiedSign != null">qualified_sign,</if>
	        <if test="measureResultPath != null">measure_result_path,</if>
	        <if test="projectUnit != null">project_unit,</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>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                <if test="id != null">#{id,jdbcType=BIGINT},</if>
                <if test="patientId != null">#{patientId,jdbcType=BIGINT},</if>
                <if test="patientName != null">#{patientName,jdbcType=VARCHAR},</if>
                <if test="cardNo != null">#{cardNo,jdbcType=VARCHAR},</if>
                <if test="batchId != null">#{batchId,jdbcType=BIGINT},</if>
                <if test="batchName != null">#{batchName,jdbcType=VARCHAR},</if>
                <if test="groupId != null">#{groupId,jdbcType=BIGINT},</if>
                <if test="groupName != null">#{groupName,jdbcType=VARCHAR},</if>
                <if test="projectId != null">#{projectId,jdbcType=BIGINT},</if>
                <if test="projectName != null">#{projectName,jdbcType=VARCHAR},</if>
                <if test="deviceId != null">#{deviceId,jdbcType=BIGINT},</if>
                <if test="deviceName != null">#{deviceName,jdbcType=VARCHAR},</if>
                <if test="projectAlias != null">#{projectAlias,jdbcType=VARCHAR},</if>
                <if test="judgeMode != null">#{judgeMode,jdbcType=VARCHAR},</if>
                <if test="measureResult != null">#{measureResult,jdbcType=VARCHAR},</if>
                <if test="maxValue != null">#{maxValue,jdbcType=INTEGER},</if>
                <if test="minValue != null">#{minValue,jdbcType=INTEGER},</if>
                <if test="defaultValue != null">#{defaultValue,jdbcType=VARCHAR},</if>
                <if test="lisCompare != null">#{lisCompare,jdbcType=VARCHAR},</if>
                <if test="measureTime != null">#{measureTime,jdbcType=TIMESTAMP},</if>
                <if test="measureName != null">#{measureName,jdbcType=VARCHAR},</if>
                <if test="recordRemark != null">#{recordRemark,jdbcType=VARCHAR},</if>
                <if test="qualifiedSign != null">#{qualifiedSign,jdbcType=VARCHAR},</if>
		        <if test="measureResultPath != null">#{measureResultPath,jdbcType=VARCHAR},</if>
		        <if test="projectUnit != null">#{projectUnit,jdbcType=VARCHAR},</if>
                <if test="createBy != null">#{createBy,jdbcType=VARCHAR},</if>
                <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
                <if test="updateBy != null">#{updateBy,jdbcType=VARCHAR},</if>
                <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.xinelu.manage.domain.projectlastresult.ProjectLastResult">
        update project_last_result
        <set>
                <if test="patientId != null">
                    patient_id = #{patientId,jdbcType=BIGINT},
                </if>
                <if test="patientName != null">
                    patient_name = #{patientName,jdbcType=VARCHAR},
                </if>
                <if test="cardNo != null">
                    card_no = #{cardNo,jdbcType=VARCHAR},
                </if>
                <if test="batchId != null">
                    batch_id = #{batchId,jdbcType=BIGINT},
                </if>
                <if test="batchName != null">
                    batch_name = #{batchName,jdbcType=VARCHAR},
                </if>
                <if test="groupId != null">
                    group_id = #{groupId,jdbcType=BIGINT},
                </if>
                <if test="groupName != null">
                    group_name = #{groupName,jdbcType=VARCHAR},
                </if>
                <if test="projectId != null">
                    project_id = #{projectId,jdbcType=BIGINT},
                </if>
                <if test="projectName != null">
                    project_name = #{projectName,jdbcType=VARCHAR},
                </if>
                <if test="deviceId != null">
                    device_id = #{deviceId,jdbcType=BIGINT},
                </if>
                <if test="deviceName != null">
                    device_name = #{deviceName,jdbcType=VARCHAR},
                </if>
                <if test="projectAlias != null">
                    project_alias = #{projectAlias,jdbcType=VARCHAR},
                </if>
                <if test="judgeMode != null">
                    judge_mode = #{judgeMode,jdbcType=VARCHAR},
                </if>
                <if test="measureResult != null">
                    measure_result = #{measureResult,jdbcType=VARCHAR},
                </if>
                <if test="maxValue != null">
                    max_value = #{maxValue,jdbcType=INTEGER},
                </if>
                <if test="minValue != null">
                    min_value = #{minValue,jdbcType=INTEGER},
                </if>
                <if test="defaultValue != null">
                    default_value = #{defaultValue,jdbcType=VARCHAR},
                </if>
                <if test="lisCompare != null">
                    lis_compare = #{lisCompare,jdbcType=VARCHAR},
                </if>
                <if test="measureTime != null">
                    measure_time = #{measureTime,jdbcType=TIMESTAMP},
                </if>
                <if test="measureName != null">
                    measure_name = #{measureName,jdbcType=VARCHAR},
                </if>
                <if test="recordRemark != null">
                    record_remark = #{recordRemark,jdbcType=VARCHAR},
                </if>
                <if test="qualifiedSign != null">
                    qualified_sign = #{qualifiedSign,jdbcType=VARCHAR},
                </if>
	        	<if test="measureResultPath != null">
            		measure_result_path = #{measureResultPath,jdbcType=VARCHAR},
            	</if>
	        	<if test="projectUnit != null">
            		project_unit = #{projectUnit,jdbcType=VARCHAR},
            	</if>
                <if test="createBy != null">
                    create_by = #{createBy,jdbcType=VARCHAR},
                </if>
                <if test="createTime != null">
                    create_time = #{createTime,jdbcType=TIMESTAMP},
                </if>
                <if test="updateBy != null">
                    update_by = #{updateBy,jdbcType=VARCHAR},
                </if>
                <if test="updateTime != null">
                    update_time = #{updateTime,jdbcType=TIMESTAMP},
                </if>
        </set>
        where   id = #{id,jdbcType=BIGINT} 
    </update>
    <update id="updateByPrimaryKey" parameterType="com.xinelu.manage.domain.projectlastresult.ProjectLastResult">
        update project_last_result
        set 
            patient_id =  #{patientId,jdbcType=BIGINT},
            patient_name =  #{patientName,jdbcType=VARCHAR},
            card_no =  #{cardNo,jdbcType=VARCHAR},
            batch_id =  #{batchId,jdbcType=BIGINT},
            batch_name =  #{batchName,jdbcType=VARCHAR},
            group_id =  #{groupId,jdbcType=BIGINT},
            group_name =  #{groupName,jdbcType=VARCHAR},
            project_id =  #{projectId,jdbcType=BIGINT},
            project_name =  #{projectName,jdbcType=VARCHAR},
            device_id =  #{deviceId,jdbcType=BIGINT},
            device_name =  #{deviceName,jdbcType=VARCHAR},
            project_alias =  #{projectAlias,jdbcType=VARCHAR},
            judge_mode =  #{judgeMode,jdbcType=VARCHAR},
            measure_result =  #{measureResult,jdbcType=VARCHAR},
            max_value =  #{maxValue,jdbcType=INTEGER},
            min_value =  #{minValue,jdbcType=INTEGER},
            default_value =  #{defaultValue,jdbcType=VARCHAR},
            lis_compare =  #{lisCompare,jdbcType=VARCHAR},
            measure_time =  #{measureTime,jdbcType=TIMESTAMP},
            measure_name =  #{measureName,jdbcType=VARCHAR},
            record_remark =  #{recordRemark,jdbcType=VARCHAR},
            qualified_sign =  #{qualifiedSign,jdbcType=VARCHAR},
		    measure_result_path = #{measureResultPath,jdbcType=VARCHAR},
		    project_unit = #{projectUnit,jdbcType=VARCHAR},
            create_by =  #{createBy,jdbcType=VARCHAR},
            create_time =  #{createTime,jdbcType=TIMESTAMP},
            update_by =  #{updateBy,jdbcType=VARCHAR},
            update_time =  #{updateTime,jdbcType=TIMESTAMP}
        where   id = #{id,jdbcType=BIGINT} 
    </update>
</mapper>
