<?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.bonus.canteen.core.nutrition.mapper.HealthCustMedicalReportDetailMapper">

    <select id="listCustReportDetail" resultType="com.bonus.canteen.core.nutrition.common.vo.HealthCustMedicalReportDetailVO">
        SELECT DISTINCT
            t1.medical_project_detail_id,
            t1.medical_project_detail_name,
            t1.result,
            t2.medical_project_detail_unit,
            t2.medical_project_detail_reference,
            t1.create_time
        FROM
            health_cust_medical_report_detail t1
                LEFT JOIN health_medical_report_detail t2 ON t1.medical_project_detail_id = t2.medical_project_detail_id
                LEFT JOIN health_cust_medical_report_project t3 ON t1.medical_id = t3.medical_id
        WHERE
            t3.medical_id = #{medicalId}
          AND t1.medical_project_id = #{medicalProjectId}
        ORDER BY
            t1.medical_project_detail_id
    </select>
</mapper>
