<?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.DoctorInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.DoctorInfo">
        <id column="id" property="id" />
        <result column="is_deleted" property="isDeleted" />
        <result column="gmt_create" property="gmtCreate" />
        <result column="gmt_modified" property="gmtModified" />
        <result column="creator" property="creator" />
        <result column="modifier" property="modifier" />
        <result column="hospital_code" property="hospitalCode" />
        <result column="hospital_dept_code" property="hospitalDeptCode" />
        <result column="code" property="code" />
        <result column="name" property="name" />
        <result column="sex" property="sex" />
        <result column="id_type" property="idType" />
        <result column="id_no" property="idNo" />
        <result column="address" property="address" />
        <result column="phone" property="phone" />
        <result column="remark" property="remark" />
    </resultMap>

    <select id="getDoctorInfos" resultType="com.diagbot.dto.DoctorInfoDTO">
        SELECT a.* FROM `tran_doctor_info` a
        LEFT JOIN tran_hospital_dept b ON a.hospital_dept_code = b.`code`
        WHERE a.is_deleted = 'N' AND b.is_deleted = 'N'
        AND a.`code` = #{doctorCode} AND b.hospital_code = #{hospitalCode} AND b.`code` = #{deptCode}
    </select>
</mapper>
