<?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.openhis.administration.mapper.EncounterMapper">

    <select id="getEncounterInfoByTime" resultType="com.openhis.administration.dto.EncounterAccountDto">
        SELECT T1.ID,
               T1.patient_id,
               T1.group_id,
               T1.bus_no,
               T1.status_enum,
               T1.class_enum,
               T1.yb_class_enum,
               T1.yb_class_text,
               T1.class_json,
               T1.priority_enum,
               T1.type_enum,
               T1.service_type_id,
               T1.subject_status_enum,
               T1.start_time,
               T1.end_time,
               T1.reception_time,
               T1.organization_id,
               T1.display_order,
               T1.first_enum,
               T1.admit_source_code,
               T1.in_way_code,
               T1.amb_encounter_id,
               T1.registrar_id,
               T2.status_enum,
               T2.billing_status_enum,
               T2.type_code,
               T2.NO,
               T2.NAME,
               T2.patient_id,
               T2.encounter_id,
               T2.balance_amount,
               T2.yb_area_no,
               T2.contract_no,
               T2.limit_account,
               T2.encounter_flag
        FROM adm_encounter T1
                 LEFT JOIN adm_account T2 ON T1.ID = T2.encounter_id
            AND T2.encounter_flag = 1
            AND T2.delete_flag = '0'
        WHERE T1.create_time &gt;
              #{startDate}
          AND T1.create_time &lt;
              #{endDate};
    </select>
</mapper>