<?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.supervision.mapper.DiseasePhysicalMapper">

    <resultMap id="BaseResultMap" type="com.supervision.model.DiseasePhysical">
            <id property="id" column="id" jdbcType="VARCHAR"/>
            <result property="diseaseId" column="disease_id" jdbcType="VARCHAR"/>
            <result property="toolId" column="tool_id" jdbcType="VARCHAR"/>
            <result property="locationId" column="location_id" jdbcType="VARCHAR"/>
            <result property="requireCheckFlag" column="require_check_flag" jdbcType="INTEGER"/>
            <result property="primarilyDiagnosisCriteriaFlag" column="primarily_diagnosis_criteria_flag" jdbcType="INTEGER"/>
            <result property="basisConfirmFlag" column="basis_confirm_flag" jdbcType="INTEGER"/>
            <result property="basisIdentificationFlag" column="basis_identification_flag" jdbcType="INTEGER"/>
            <result property="diagnosisAssessmentFlag" column="diagnosis_assessment_flag" jdbcType="INTEGER"/>
            <result property="expectedDiagnosisResult" column="expected_diagnosis_result" jdbcType="VARCHAR"/>
            <result property="fullCheckFlag" column="full_check_flag" jdbcType="INTEGER"/>
            <result property="locationDiagnosisFlag" column="location_diagnosis_flag" jdbcType="INTEGER"/>
            <result property="result" column="result" jdbcType="VARCHAR"/>
            <result property="trait" column="trait" jdbcType="VARCHAR"/>
            <result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,tool_id,location_id,disease_id,
        require_check_flag,primarily_diagnosis_criteria_flag,basis_confirm_flag,
        diagnosis_assessment_flag,expected_diagnosis_result,full_check_flag,
        basis_identification_flag,result,trait,
        create_user_id,create_time,update_user_id,
        update_time
    </sql>

    <select id="queryListByDiseaseId" resultType="com.supervision.vo.manage.DiseasePhysicalResVo">
        select dp.id,
               dp.disease_id                        as diseaseId,
               dp.tool_id                           as toolId,
               cpl.parent_id                        as toolParentId,
               dp.location_id                       as locationId,
               cpt.tool_name                        as toolName,
               cpt.type                             as toolType,
               dp.primarily_diagnosis_criteria_flag as primarilyDiagnosisCriteriaFlag,
               dp.basis_confirm_flag                as basisConfirmFlag,
               dp.basis_identification_flag         as basisIdentificationFlag,
               dp.full_check_flag                   as fullCheckFlag,
               dp.diagnosis_assessment_flag         as diagnosisAssessmentFlag,
               dp.expected_diagnosis_result         as expectedDiagnosisResult,
               dp.require_check_flag                as asrequireCheckFlag,
               dp.result                            as result,
               dp.trait                             as trait
        from vp_disease_physical dp
                 left join vp_config_physical_tool cpt on dp.tool_id = cpt.id
                 left join vp_config_physical_location cpl on dp.location_id = cpl.id
        where dp.disease_id = #{diseaseId} order by dp.create_time desc
    </select>
</mapper>