<?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.lantone.daqe.mapper.DiseaseInfoMapper">

    <select id="getMatchingDiseasePage" resultType="com.lantone.daqe.dto.GetMatchingDiseasePageDTO">
        SELECT
            icd10,
            standard,
            synonym,
            CASE
        WHEN ISNULL(standard) THEN
            '0'
        ELSE
            '1'
        END AS isMapping
        FROM
            `hos_disease_info`
        WHERE
        1=1
        <if test="getMatchingDiseasePageVO.hospitalId != null">
            hospital_id = #{getMatchingDiseasePageVO.hospitalId}
        </if>
        <if test="getMatchingDiseasePageVO.id != null">
            AND id = #{getMatchingDiseasePageVO.id}
        </if>
        <if test="getMatchingDiseasePageVO.name != null and getMatchingDiseasePageVO.name != ''">
            AND `name` LIKE  CONCAT('%',#{getMatchingDiseasePageVO.name},'%')
        </if>
    </select>
</mapper>