<?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.saye.hospitalgd.mapper.TranscationsMapper">


    <select id="findTradeRecords" parameterType="HashMap" resultType="HashMap">

        select ID
        ,PAY_SOURCE
        ,SERVER_CHANNEL
        ,PATIENT_ID
        ,PAY_CHANNEL
        ,SICK_NAME
        ,MOBILE_PHONE
        ,CARD_NO
        ,ID_NO
        ,VISIT_NO
        ,COST
        ,HOSPITAL_NO
        ,AGGREGATED_PAY_FLAG
        ,AUTH_CODE
        ,OPERATOR
        ,OPERATOR_NAME
        ,ORDER_STATE
        ,PLATFORM_NO
        ,THRIDPLATFORM_NO
        ,PAY_WAY
        ,PAYSTATUS_INFO
        ,REFUND_COST
        ,CAN_REFUND_COST
        ,REFUND_STATE
        ,ORG_CODE
        ,APP_CODE
        ,TERMINAL_CODE
        ,TIME_STAMP
        ,OTHER_INFO

        from payorder_manage
        <where>
            <if test="startTime!=null and startTime!=''">
                and TIME_STAMP &gt;= #{startTime}
            </if>
            <if test="endTime!=null and endTime!=''">
                and TIME_STAMP &lt;= #{endTime}
            </if>
            <if test="jyly!=null and jyly!=''">
                and PAY_SOURCE = #{jyly}
            </if>
            <if test="likeFiled!=null and likeFiled!=''">
                and PLATFORM_NO like concat('%',concat(#{likeFiled},'%'))
            </if>
        </where>
        order by TIME_STAMP
    </select>
    <select id="findActionableTrading" parameterType="HashMap" resultType="HashMap">

        select ID
        ,PAY_SOURCE
        ,SERVER_CHANNEL
        ,PATIENT_ID
        ,PAY_CHANNEL
        ,SICK_NAME
        ,MOBILE_PHONE
        ,CARD_NO
        ,ID_NO
        ,VISIT_NO
        ,COST
        ,HOSPITAL_NO
        ,AGGREGATED_PAY_FLAG
        ,AUTH_CODE
        ,OPERATOR
        ,OPERATOR_NAME
        ,ORDER_STATE
        ,PLATFORM_NO
        ,THRIDPLATFORM_NO
        ,PAY_WAY
        ,PAYSTATUS_INFO
        ,REFUND_COST
        ,CAN_REFUND_COST
        ,REFUND_STATE
        ,ORG_CODE
        ,APP_CODE
        ,TERMINAL_CODE
        ,TIME_STAMP
        ,OTHER_INFO

        from payorder_manage
        <where>
            CAN_REFUND_COST > 0
            <if test="startTime!=null and startTime!=''">
                and TIME_STAMP &gt;= #{startTime}
            </if>
            <if test="endTime!=null and endTime!=''">
                and TIME_STAMP &lt;= #{endTime}
            </if>
            <if test="jyly!=null and jyly!=''">
                and PAY_SOURCE = #{jyly}
            </if>
            <if test="jylsh!=null and jylsh!=''">
                and PLATFORM_NO = #{jylsh}
            </if>
            <if test="likeFiled!=null and likeFiled!=''">
                and PLATFORM_NO like concat('%',concat(#{likeFiled},'%'))
            </if>

        </where>
        order by TIME_STAMP
    </select>
    <select id="findActionableTradingByJylsh" parameterType="HashMap" resultType="HashMap">

        select ID
        ,PAY_SOURCE
        ,SERVER_CHANNEL
        ,PATIENT_ID
        ,PAY_CHANNEL
        ,SICK_NAME
        ,MOBILE_PHONE
        ,CARD_NO
        ,ID_NO
        ,VISIT_NO
        ,COST
        ,HOSPITAL_NO
        ,AGGREGATED_PAY_FLAG
        ,AUTH_CODE
        ,OPERATOR
        ,OPERATOR_NAME
        ,ORDER_STATE
        ,PLATFORM_NO
        ,THRIDPLATFORM_NO
        ,PAY_WAY
        ,PAYSTATUS_INFO
        ,REFUND_COST
        ,CAN_REFUND_COST
        ,REFUND_STATE
        ,ORG_CODE
        ,APP_CODE
        ,TERMINAL_CODE
        ,TIME_STAMP
        ,OTHER_INFO
        from payorder_manage
        <where>
            CAN_REFUND_COST > 0
            <if test="jylsh!=null and jylsh!=''">
                and PLATFORM_NO = #{jylsh}
            </if>
        </where>
        order by TIME_STAMP
    </select>
</mapper>