<?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.eitc.patient.mapper.DiagnosisTypeOrderDoctorMapper">

    <select id="findListByDoctorId" resultType="com.eitc.patient.dto.DiagnosisTypeOrderDoctorDto">
        SELECT
            edtod.id,
            edtod.diagnosis_type_id AS diagnosisTypeId,
            edtod.parent_id AS parentId,
            edt.diagnosis_name AS diagnosisName
        FROM
            erm_diagnosis_type_order_doctor edtod
                LEFT JOIN erm_diagnosis_type edt ON edtod.diagnosis_type_id = edt.id
        WHERE
            edtod.is_del = 0
          AND edt.is_del = 0
          AND edtod.doctor_id = #{doctorId}

        ORDER BY
            edtod.parent_id,
            edtod.order_num
    </select>
    <select id="removeDoctorId">
        DELETE FROM erm_diagnosis_type_order_doctor WHERE doctor_id = #{doctorId}
    </select>
</mapper>
