<?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.ruoyi.web.work.mapper.ReportMapper">

    <select id="selectList" resultType="com.ruoyi.web.work.domain.Report">
        select * from tb_report
        <where>
            <if test="patId != null "> and pat_id = #{patId}</if>
            <if test="cardId != null "> and card_id = #{cardId}</if>
            <if test="reportNo != null and reportNo != ''"> and report_no = #{reportNo}</if>
            <if test="originalApplicationNo != null and originalApplicationNo != ''"> and original_application_no = #{originalApplicationNo}</if>
            <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
            <if test="reportClassCode != null and reportClassCode != ''"> and report_class_code = #{reportClassCode}</if>
            <if test="reportClassName != null and reportClassName != ''"> and report_class_name like concat('%', #{reportClassName}, '%')</if>
            <if test="checkDoctorCode != null and checkDoctorCode != ''"> and check_doctor_code = #{checkDoctorCode}</if>
            <if test="applyDoctorName != null and applyDoctorName != ''"> and apply_doctor_name like concat('%', #{applyDoctorName}, '%')</if>
            <if test="testingDoctorCode != null and testingDoctorCode != ''"> and testing_doctor_code = #{testingDoctorCode}</if>
            <if test="testingDoctorName != null and testingDoctorName != ''"> and testing_doctor_name like concat('%', #{testingDoctorName}, '%')</if>
            <if test="inspectionDepartmentCode != null and inspectionDepartmentCode != ''"> and inspection_department_code = #{inspectionDepartmentCode}</if>
            <if test="inspectionDepartmentName != null and inspectionDepartmentName != ''"> and inspection_department_name like concat('%', #{inspectionDepartmentName}, '%')</if>
        </where>
    </select>

    <select id="getAllReportByPatId" resultType="com.ruoyi.web.work.domain.Report">
        SELECT * FROM tb_orc_report
        WHERE tb_orc_report.pat_id=#{patId}
    </select>

    <select id="selectOrcReportByObcId" resultType="com.ruoyi.web.work.domain.Report">
        SELECT * FROM tb_orc_report
        WHERE id = #{orcId}
    </select>

</mapper>
