<?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.diagbot.mapper.MedicalMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.Medical">
        <id column="id" property="id" />
        <result column="concept_id" property="conceptId" />
        <result column="name" property="name" />
        <result column="std_name" property="stdName" />
        <result column="cate_name" property="cateName" />
        <result column="grp" property="grp" />
        <result column="function" property="function" />
        <result column="gender" property="gender" />
        <result column="min_age" property="minAge" />
        <result column="max_age" property="maxAge" />
        <result column="bodypart" property="bodypart" />
        <result column="sub_bodypart" property="subBodypart" />
        <result column="display_order" property="displayOrder" />
        <result column="dept" property="dept" />
        <result column="code" property="code" />
        <result column="note" property="note" />
        <result column="is_deleted" property="isDeleted" />
    </resultMap>


    <select id="getTypeId" parameterType="com.diagbot.vo.TypeVo" resultType="com.diagbot.dto.TypeDTO">
        SELECT id, name
        FROM lexicon
        WHERE name = #{type}
    </select>

    <select id="getLimboItems" resultType="com.diagbot.entity.Medical">
        SELECT * FROM medical WHERE concept_id in
        (
            SELECT id FROM concept WHERE lib_id NOT in
            (
                SELECT id FROM library_info WHERE is_concept = 1
            )
        )
    </select>

    <update id="truncateMedical">
        Truncate Table medical
    </update>
</mapper>
