<?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.docus.server.sdry.mapper.ShouMaViewMapper">

    <select id="getPatientShouMaView" resultType="com.docus.server.sdry.entity.ShouMaView">
        SELECT FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE FROM(
                         select FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE from t_itf_dcsm_1 where FBIHID=#{patient.inpatientNo} and FBINCU=#{patient.admissTimes}
                         union all
                         select FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE from t_itf_dcsm_2 where FBIHID=#{patient.inpatientNo} and FBINCU=#{patient.admissTimes}
                         union all
                         select FID,FBIHID,FBINCU,PDESC,PDFPATH,FUPDATE from t_itf_dcsm_3 where FBIHID=#{patient.inpatientNo} and FBINCU=#{patient.admissTimes}
                     ) T
        WHERE 1=1
        <if test="ext != null and ext != ''">
            ${ext}
        </if>
    </select>
</mapper>
