From ee089a8ac4a9d99ef0a0491bbf1d80a2d4fbc393 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期二, 10 十一月 2026 09:15:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

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

diff --git a/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml b/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
index 5ec2407..0e0c1cf 100644
--- a/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
+++ b/ruoyi-project/src/main/resources/mapper/project/ServiceDonorchargeorganMapper.xml
@@ -15,6 +15,7 @@
         <result property="hospitalno" column="HospitalNo"/>
         <result property="organno" column="OrganNo"/>
         <result property="organname" column="OrganName"/>
+        <result property="payOrganName" column="pay_organ_name"/>
         <result property="organcharge" column="organcharge"/>
         <result property="organtime" column="organtime"/>
         <result property="chargeoperator" column="chargeoperator"/>
@@ -48,6 +49,7 @@
                HospitalNo,
                OrganNo,
                OrganName,
+               pay_organ_name,
                organcharge,
                organtime,
                chargeoperator,
@@ -74,6 +76,7 @@
             resultMap="ServiceDonorchargeorganResult">
         <include refid="selectServiceDonorchargeorganVo"/>
         <where>
+            and (del_flag = 0 or del_flag is null)
             <if test="infoid != null ">and InfoID = #{infoid}</if>
             <if test="receiveTime != null ">and receive_time = #{receiveTime}</if>
             <if test="paymentid != null ">and paymentid = #{paymentid}</if>
@@ -86,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>
@@ -109,6 +123,7 @@
         o.HospitalNo,
         o.OrganNo,
         o.OrganName,
+        o.pay_organ_name,
         o.organcharge,
         o.organtime,
         o.chargeoperator,
@@ -132,6 +147,7 @@
         from service_donorchargeorgan o
                  left join service_donatebaseinfo b on b.ID = o.InfoID
         <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)
@@ -145,8 +161,20 @@
                 '%')
             </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>
@@ -161,6 +189,15 @@
         order by b.donatetime
     </select>
 
+    <update id="removeByIds">
+        update service_donorchargeorgan
+        set del_flag = 1
+        where id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
     <update id="updateDonorchargeorgan" parameterType="com.ruoyi.project.domain.ServiceDonorchargeorgan">
         update service_donorchargeorgan
         <set>
@@ -173,6 +210,7 @@
             <if test="hospitalno != null  and hospitalno != ''">HospitalNo = #{hospitalno},</if>
             <if test="organno != null  and organno != ''">OrganNo = #{organno},</if>
             <if test="organname != null  and organname != ''">OrganName = #{organname},</if>
+            <if test="payOrganName != null  and payOrganName != ''">pay_organ_name = #{payOrganName},</if>
             <if test="organcharge != null ">organcharge = #{organcharge},</if>
             <if test="organtime != null ">organtime = #{organtime},</if>
             <if test="chargeoperator != null  and chargeoperator != ''">chargeoperator = #{chargeoperator},</if>
@@ -193,9 +231,55 @@
         where id = #{id} and del_flag=0
     </update>
 
+    <resultMap id="SpStatChangeResult" type="com.ruoyi.project.domain.SpStatChange">
+        <result property="hospitalname" column="HospitalName"/>
+        <result property="amount" column="amount"/>
+        <result property="nonpayment" column="nonpayment"/>
+        <result property="organcharge" column="organcharge"/>
+    </resultMap>
+
     <select id="getListBySpStatChange" statementType="CALLABLE"
-            resultType="com.ruoyi.project.domain.SpStatChange">
-        call `SP_STAT_CHANGE`(#{PAHOSPITALNO,mode=IN,jdbcType=VARCHAR},#{PACHAGEFLAG,mode=IN,jdbcType=VARCHAR})
+            resultMap="SpStatChangeResult">
+        call `SP_STAT_CHANGE`(
+            #{PABEGTIME,mode=IN,jdbcType=VARCHAR},
+            #{PAENDTIME,mode=IN,jdbcType=VARCHAR},
+            #{PAHOSPITALNAME,mode=IN,jdbcType=VARCHAR}
+        )
+    </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