From 9e0e3500d24c60ec5acf004488eba98b87252d75 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期五, 27 十一月 2026 10:53:25 +0800
Subject: [PATCH] 器官费用表明细

---
 ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml |   76 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml b/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
index 57d7ce6..2c88423 100644
--- a/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
+++ b/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
@@ -89,6 +89,17 @@
             <if test="hospitalno != null  and hospitalno != ''">and HospitalNo = #{hospitalno}</if>
             <if test="organno != null  and organno != ''">and OrganNo = #{organno}</if>
             <if test="organname != null  and organname != ''">and OrganName like concat('%', #{organname}, '%')</if>
+            <if test="organState != null  and organState != ''">and organ_state = #{organState}</if>
+            <if test="payStatus != null  and payStatus != ''">
+                <choose>
+                    <when test="payStatus == '宸蹭粯'">
+                        and organcharge is not null and (organcharge - IFNULL(amount, 0)) = 0
+                    </when>
+                    <when test="payStatus == '鏈粯'">
+                        and organcharge is not null and (organcharge - IFNULL(amount, 0)) &lt;&gt; 0
+                    </when>
+                </choose>
+            </if>
             <if test="organcharge != null ">and organcharge = #{organcharge}</if>
             <if test="organtime != null ">and organtime = #{organtime}</if>
             <if test="chargeoperator != null  and chargeoperator != ''">and chargeoperator = #{chargeoperator}</if>
@@ -132,7 +143,7 @@
         o.annex_files,
         o.organ_state,
         o.organ_charge_state,
-        b.donatetime
+        o.donationtime
         from service_donorchargeorgan o
                  left join service_donatebaseinfo b on b.ID = o.InfoID
         <where>
@@ -153,6 +164,17 @@
             <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>
@@ -161,10 +183,56 @@
             <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 b.donatetime &gt;= #{starttime}</if>
-            <if test="endtime != null ">and b.donatetime &lt;= #{endtime}</if>
+            <if test="starttime != null ">and o.donationtime &gt;= #{starttime}</if>
+            <if test="endtime != null ">and o.donationtime &lt;= #{endtime}</if>
         </where>
-        order by b.donatetime
+        order by o.donationtime desc
+    </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">

--
Gitblit v1.9.3