sinake
13 小时以前 557516aa71db17024c5ad6d6a35b4628d5919e23
ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
@@ -189,6 +189,52 @@
        order by b.donatetime
    </select>
    <select id="organfeeSummary" parameterType="com.ruoyi.project.domain.ServiceDonorchargeorgan"
            resultType="Map">
        select sum(organcharge) organchargeTotal, sum(amount) amountTotal, sum(organcharge)- sum(amount) unreceivedTotal,count(*) rowCount
        from service_donorchargeorgan o
        <where>
            and (o.del_flag = 0 or o.del_flag is null)
            <if test="selectAll != true ">
                and (o.paymentid IS NULL or o.paymentid=0 or organcharge-amount>0)
                and (organ_charge_state =0 OR organ_charge_state IS null)
            </if>
            <if test="infoid != null ">and o.InfoID = #{infoid}</if>
            <if test="receiveTime != null ">and o.receive_time = #{receiveTime}</if>
            <if test="paymentno != null ">and o.paymentno = #{paymentno}</if>
            <if test="donorchargeid != null ">and o.donorchargeID = #{donorchargeid}</if>
            <if test="donorname != null  and donorname != ''">and o.donorname like concat('%', #{donorname}, '%')</if>
            <if test="hospitalname != null  and hospitalname != ''">and o.HospitalName like concat('%', #{hospitalname},
                '%')
            </if>
            <if test="hospitalno != null  and hospitalno != ''">and o.HospitalNo = #{hospitalno}</if>
            <if test="hospitalnoIsNull == true">and (o.Hospitalname is null or o.Hospitalname = '')</if>
            <if test="organno != null  and organno != ''">and o.OrganNo = #{organno}</if>
            <if test="organname != null  and organname != ''">and o.OrganName like concat('%', #{organname}, '%')</if>
            <if test="organState != null  and organState != ''">and o.organ_state = #{organState}</if>
            <if test="payStatus != null  and payStatus != ''">
                <choose>
                    <when test="payStatus == '已付'">
                        and o.organcharge is not null and (o.organcharge - IFNULL(o.amount, 0)) = 0
                    </when>
                    <when test="payStatus == '未付'">
                        and o.organcharge is not null and (o.organcharge - IFNULL(o.amount, 0)) &lt;&gt; 0
                    </when>
                </choose>
            </if>
            <if test="organcharge != null ">and o.organcharge = #{organcharge}</if>
            <if test="organtime != null ">and o.organtime = #{organtime}</if>
            <if test="chargeoperator != null  and chargeoperator != ''">and o.chargeoperator = #{chargeoperator}</if>
            <if test="amount != null ">and o.amount = #{amount}</if>
            <if test="amounttime != null ">and o.amounttime = #{amounttime}</if>
            <if test="amountoperator != null  and amountoperator != ''">and o.amountoperator = #{amountoperator}</if>
            <if test="chargestate != null ">and o.chargestate = #{chargestate}</if>
            <if test="organchargedesc != null  and organchargedesc != ''">and o.organchargedesc = #{organchargedesc}</if>
            <if test="starttime != null ">and donationtime &gt;= #{starttime}</if>
            <if test="endtime != null ">and donationtime &lt;= #{endtime}</if>
        </where>
    </select>
    <update id="removeByIds">
        update service_donorchargeorgan
        set del_flag = 1