From 5f971ca24e695f6b733910f5eac567656c7edd3b Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 04 十一月 2026 10:00:54 +0800
Subject: [PATCH] 修改了收费器官查询

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

diff --git a/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml b/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
index 7b169e7..9720d4d 100644
--- a/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
+++ b/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
@@ -88,6 +88,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>
@@ -150,6 +161,17 @@
             <if test="hospitalno != null  and hospitalno != ''">and o.HospitalNo = #{hospitalno}</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>
@@ -213,4 +235,39 @@
         )
     </select>
 
+    <resultMap id="SpStatChangeDetailResult" type="com.ruoyi.project.domain.SpStatChangeDetail">
+        <result property="donatetime" column="donatetime"/>
+        <result property="donorname" column="donorname"/>
+        <result property="organno" column="OrganNo"/>
+        <result property="organname" column="OrganName"/>
+        <result property="name" column="name"/>
+        <result property="caseno" column="caseno"/>
+        <result property="hospitalname" column="HospitalName"/>
+        <result property="organcharge" column="organcharge"/>
+        <result property="amount" column="amount"/>
+        <result property="nonpayment" column="nonpayment"/>
+    </resultMap>
+
+    <select id="getSpStatChangeDetail" resultMap="SpStatChangeDetailResult">
+        select b.donatetime,
+               o.donorname,
+               o.OrganNo,
+               o.OrganName,
+               o.name,
+               o.caseno,
+               o.HospitalName,
+               o.organcharge,
+               o.amount,
+               (ifnull(o.organcharge, 0) - ifnull(o.amount, 0)) as nonpayment
+        from service_donorchargeorgan o
+                 left join service_donatebaseinfo b on b.ID = o.InfoID
+        where o.del_flag = 0
+        <if test="PABEGTIME != null and PABEGTIME != ''">and b.donatetime &gt;= #{PABEGTIME}</if>
+        <if test="PAENDTIME != null and PAENDTIME != ''">and b.donatetime &lt;= #{PAENDTIME}</if>
+        <if test="PAHOSPITALNAME != null and PAHOSPITALNAME != ''">and o.HospitalName = #{PAHOSPITALNAME}</if>
+        <if test='"1".equals(PACHARGESTATE)'>and ifnull(o.amount, 0) &gt; 0</if>
+        <if test='"0".equals(PACHARGESTATE)'>and (ifnull(o.organcharge, 0) - ifnull(o.amount, 0)) &gt; 0</if>
+        order by b.donatetime
+    </select>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3