sinake
18 小时以前 b88b42be258535e65d38888823ac85fd8467b571
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?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.ruoyi.project.mapper.ServiceDonorchargeorganMapper">
 
    <resultMap type="com.ruoyi.project.domain.ServiceDonorchargeorgan" id="ServiceDonorchargeorganResult">
        <result property="id" column="ID"/>
        <result property="infoid" column="InfoID"/>
        <result property="donorchargeid" column="donorchargeid"/>
        <result property="paymentid" column="paymentid"/>
        <result property="paymentno" column="paymentno"/>
        <result property="donorname" column="donorname"/>
        <result property="hospitalname" column="HospitalName"/>
        <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"/>
        <result property="amount" column="amount"/>
        <result property="amounttime" column="amounttime"/>
        <result property="amountoperator" column="amountoperator"/>
        <result property="chargestate" column="chargestate"/>
        <result property="organchargedesc" column="organchargedesc"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="caseno" column="caseno"/>
        <result property="name" column="name"/>
        <result property="receiveTime" column="receive_time"/>
        <result property="annexFiles" column="annex_files"/>
        <result property="donatetime" column="donatetime"/>
        <result property="organState" column="organ_state"/>
        <result property="organChargeState" column="organ_charge_state"/>
    </resultMap>
 
    <sql id="selectServiceDonorchargeorganVo">
        select ID,
               donorchargeid,
               paymentid,
               paymentno,
               InfoID,
               donorname,
               HospitalName,
               HospitalNo,
               OrganNo,
               OrganName,
               pay_organ_name,
               organcharge,
               organtime,
               chargeoperator,
               amount,
               amounttime,
               amountoperator,
               chargestate,
               organchargedesc,
               del_flag,
               create_by,
               create_time,
               update_by,
               update_time,
               caseno,
               name,
               receive_time,
               annex_files,
               organ_state,
               organ_charge_state
        from service_donorchargeorgan
    </sql>
 
    <select id="selectServiceDonorchargeorganList" parameterType="com.ruoyi.project.domain.ServiceDonorchargeorgan"
            resultMap="ServiceDonorchargeorganResult">
        <include refid="selectServiceDonorchargeorganVo"/>
        <where>
            <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>
            <if test="paymentno != null ">and paymentno = #{paymentno}</if>
            <if test="donorchargeid != null ">and donorchargeID = #{donorchargeid}</if>
            <if test="donorname != null  and donorname != ''">and donorname like concat('%', #{donorname}, '%')</if>
            <if test="hospitalname != null  and hospitalname != ''">and HospitalName like concat('%', #{hospitalname},
                '%')
            </if>
            <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="organcharge != null ">and organcharge = #{organcharge}</if>
            <if test="organtime != null ">and organtime = #{organtime}</if>
            <if test="chargeoperator != null  and chargeoperator != ''">and chargeoperator = #{chargeoperator}</if>
            <if test="amount != null ">and amount = #{amount}</if>
            <if test="amounttime != null ">and amounttime = #{amounttime}</if>
            <if test="amountoperator != null  and amountoperator != ''">and amountoperator = #{amountoperator}</if>
            <if test="chargestate != null ">and chargestate = #{chargestate}</if>
            <if test="organchargedesc != null  and organchargedesc != ''">and organchargedesc = #{organchargedesc}</if>
        </where>
    </select>
 
    <select id="queryListBypaymentidIsNull" parameterType="com.ruoyi.project.domain.ServiceDonorchargeorgan"
            resultMap="ServiceDonorchargeorganResult">
        select o.ID,
        o.donorchargeid,
        o.paymentid,
        o.paymentno,
        o.InfoID,
        o.donorname,
        o.HospitalName,
        o.HospitalNo,
        o.OrganNo,
        o.OrganName,
        o.pay_organ_name,
        o.organcharge,
        o.organtime,
        o.chargeoperator,
        o.amount,
        o.amounttime,
        o.amountoperator,
        o.chargestate,
        o.organchargedesc,
        o.del_flag,
        o.create_by,
        o.create_time,
        o.update_by,
        o.update_time,
        o.caseno,
        o.name,
        o.receive_time,
        o.annex_files,
        o.organ_state,
        o.organ_charge_state,
        b.donatetime
        from service_donorchargeorgan o
                 left join service_donatebaseinfo b on b.ID = o.InfoID
        <where>
            <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="organno != null  and organno != ''">and o.OrganNo = #{organno}</if>
            <if test="organname != null  and organname != ''">and o.OrganName like concat('%', #{organname}, '%')</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 b.donatetime &gt;= #{starttime}</if>
            <if test="endtime != null ">and b.donatetime &lt;= #{endtime}</if>
        </where>
        order by b.donatetime
    </select>
 
    <update id="updateDonorchargeorgan" parameterType="com.ruoyi.project.domain.ServiceDonorchargeorgan">
        update service_donorchargeorgan
        <set>
            <if test="infoid != null ">InfoID = #{infoid},</if>
            <if test="receiveTime != null ">receive_time = #{receiveTime},</if>
            <if test="paymentno != null ">paymentno = #{paymentno},</if>
            <if test="donorchargeid != null ">donorchargeID = #{donorchargeid},</if>
            <if test="donorname != null  and donorname != ''">donorname=#{donorname},</if>
            <if test="hospitalname != null  and hospitalname != ''">HospitalName= #{hospitalname},</if>
            <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>
            <if test="amount != null ">amount = #{amount},</if>
            <if test="amounttime != null ">amounttime = #{amounttime},</if>
            <if test="amountoperator != null  and amountoperator != ''">amountoperator = #{amountoperator},</if>
            <if test="chargestate != null ">chargestate = #{chargestate},</if>
            <if test="organchargedesc != null  and organchargedesc != ''">organchargedesc = #{organchargedesc},</if>
            <if test="caseno != null  and caseno != ''">caseno = #{caseno},</if>
            <if test="name != null  and name != ''">name = #{name},</if>
            <if test="annexFiles != null  and annexFiles != ''">annex_files = #{annexFiles},</if>
            <if test="receiveTime != null">receive_time = #{receiveTime},</if>
            <if test="organState != null ">organ_state = #{organState},</if>
            <if test="organChargeState != null ">organ_charge_state = #{organChargeState},</if>
            paymentid = #{paymentid},
            update_time = sysdate()
        </set>
        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"
            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>