<?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.fsy.mapper.JswzhPatientInfoViewMapper">
    <sql id="JswzhPatientInfoViewField">
        JZH,ZY,ZYCS,XM,XB,RYRQ,RYKSBQ,RYKSMC,CWDM,DQYS,NL,SFZH,LXDH,CYRQ,DQBQ,DQKS,ZJINE,ZYZT,CYQK,SFSW,JZKH
    </sql>

    <select id="getInHospital" resultType="com.docus.server.fsy.entity.JswzhPatientInfoView">
        SELECT <include refid="JswzhPatientInfoViewField"/>
        FROM VIEW_JSWZH_PATIENT_INFO
        WHERE ZYZT = 'I'
    </select>

    <select id="getDischarge" resultType="com.docus.server.fsy.entity.JswzhPatientInfoView">
        SELECT * FROM (
            SELECT t.*,ROWNUM rn
            FROM VIEW_JSWZH_PATIENT_INFO t
            WHERE
                (ZYZT = 'B' OR ZYZT='O')
                AND
                CYRQ BETWEEN TO_DATE(#{disDateBegin},'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{disDateEnd},'YYYY-MM-DD HH24:MI:SS')
        ) WHERE rn BETWEEN ${startRow} AND ${endRow}
    </select>


</mapper>
