liusheng
2023-11-10 6f344e6360751574f7e03b21c00cfa3f4b2bc099
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
<?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.ServiceDonateorganMapper">
 
    <resultMap type="com.ruoyi.project.domain.ServiceDonateorgan" id="ServiceDonateorganResult">
        <result property="id" column="ID"/>
        <result property="infoid" column="InfoID"/>
        <result property="donorno" column="DonorNo"/>
        <result property="organno" column="OrganNo"/>
        <result property="organname" column="OrganName"/>
        <result property="organstate" column="OrganState"/>
        <result property="organnumber" column="OrganNumber"/>
        <result property="organgettime" column="OrganGetTime"/>
        <result property="organgetdoct" column="OrganGetDoct"/>
        <result property="gainhospitalno" column="GainHospitalNo"/>
        <result property="gainhospitalname" column="GainHospitalName"/>
        <result property="transplanthospitalno" column="TransplantHospitalNo"/>
        <result property="transplanthospitalname" column="TransplantHospitalName"/>
        <result property="abandonreason" column="AbandonReason"/>
        <result property="reallocationreason" column="ReallocationReason"/>
        <result property="transplantdoct" column="TransplantDoct"/>
        <result property="transplanttime" column="TransplantTime"/>
        <result property="isbiopsybefore" column="IsBiopsyBefore"/>
        <result property="isbiopsyafter" column="IsBiopsyAfter"/>
        <result property="ismarginalorgan" column="IsMarginalOrgan"/>
        <result property="ispathogenpositive" column="IsPathogenPositive"/>
        <result property="ispnf" column="IsPNF"/>
        <result property="isdgf" column="IsDGF"/>
        <result property="del_flag" 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="applicantuserid" column="ApplicantUserID"/>
        <result property="applicantusername" column="ApplicantUserName"/>
        <result property="applicanttime" column="ApplicantTime"/>
        <result property="checkuserid" column="CheckUserID"/>
        <result property="caseno"    column="CaseNo"    />
        <result property="checkusername" column="CheckUserName"/>
        <result property="checktime" column="CheckTime"/>
        <result property="checksuggestion" column="CheckSuggestion"/>
        <result property="allocationstatus" column="AllocationStatus"/>
        <result property="name" column="Name"/>
        <result property="sex" column="Sex"/>
        <result property="idcardtype" column="IDCardType"/>
        <result property="idcardno" column="IDCardNo"/>
        <result property="age" column="Age"/>
        <result property="ageunit" column="AgeUnit"/>
        <result property="birthday" column="Birthday"/>
        <result property="phone" column="Phone"/>
        <result property="residenceaddress" column="ResidenceAddress"/>
        <result property="residenceprovince" column="ResidenceProvince"/>
        <result property="residenceprovincename" column="ResidenceProvinceName"/>
        <result property="residencecity" column="ResidenceCity"/>
        <result property="residencecityname" column="ResidenceCityName"/>
        <result property="residencetown" column="ResidenceTown"/>
        <result property="residencetownname" column="ResidenceTownName"/>
        <result property="residencecommunity" column="ResidenceCommunity"/>
        <result property="residencecommunityname" column="ResidenceCommunityName"/>
        <result property="residencecountycode" column="ResidenceCountyCode"/>
        <result property="residencecountyname" column="ResidenceCountyName"/>
        <result property="organcharge" column="organcharge"/>
        <result property="organchargeoperator" column="organchargeoperator"/>
        <result property="organchargedate" column="organchargedate"/>
        <result property="organamount" column="organamount"/>
        <result property="chargestate" column="chargestate"/>
        <result property="organchargedesc" column="organchargedesc"/>
        <result property="notgetreason" column="notgetreason"/>
        <result property="transplantstate" column="transplantstate"/>
    </resultMap>
 
    <sql id="selectServiceDonateorganVo">
        select ID,
               InfoID,
               DonorNo,
               OrganNo,
               OrganName,
               OrganState,
               OrganNumber,
               OrganGetTime,
               CaseNo,
               OrganGetDoct,
               GainHospitalNo,
               GainHospitalName,
               TransplantHospitalNo,
               TransplantHospitalName,
               TransplantDoct,
               TransplantTime,
               AbandonReason,
               ReallocationReason,
               IsBiopsyBefore,
               IsBiopsyAfter,
               IsMarginalOrgan,
               IsPathogenPositive,
               IsPNF,
               IsDGF,
               del_flag,
               create_by,
               create_time,
               update_by,
               update_time,
               ApplicantUserID,
               ApplicantUserName,
               ApplicantTime,
               CheckUserID,
               ApplicantUserName,
               ApplicantTime,
               CheckUserID,
               CheckUserName,
               CheckTime,
               CheckSuggestion,
               AllocationStatus,
               Name,
               Sex,
               IDCardType,
               IDCardNo,
               Age,
               AgeUnit,
               Birthday,
               Phone,
               ResidenceAddress,
               ResidenceProvince,
               ResidenceProvinceName,
               ResidenceCity,
               ResidenceCityName,
               ResidenceTown,
               ResidenceTownName,
               ResidenceCommunity,
               ResidenceCommunityName,
               ResidenceCountyCode,
               ResidenceCountyName,
               organcharge,
               organchargeoperator,
               organchargedate,
               organamount,
               chargestate,
               organchargedesc,
               notgetreason,
               transplantstate
        from service_donateorgan
    </sql>
 
    <select id="selectServiceDonateorganList" parameterType="com.ruoyi.project.domain.ServiceDonateorgan"
            resultMap="ServiceDonateorganResult">
        <include refid="selectServiceDonateorganVo"/>
        <where>
            <if test="infoid != null ">and InfoID = #{infoid}</if>
            <if test="donorno != null  and donorno != ''">and DonorNo = #{donorno}</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 = #{organstate}</if>
            <if test="organnumber != null  and organnumber != ''">and OrganNumber = #{organnumber}</if>
            <if test="organgettime != null ">and OrganGetTime = #{organgettime}</if>
            <if test="organgetdoct != null  and organgetdoct != ''">and OrganGetDoct = #{organgetdoct}</if>
            <if test="gainhospitalno != null  and gainhospitalno != ''">and GainHospitalNo = #{gainhospitalno}</if>
            <if test="gainhospitalname != null  and gainhospitalname != ''">and GainHospitalName like concat('%',
                #{gainhospitalname}, '%')
            </if>
            <if test="transplanthospitalno != null  and transplanthospitalno != ''">and TransplantHospitalNo =
                #{transplanthospitalno}
            </if>
            <if test="transplanthospitalname != null  and transplanthospitalname != ''">and TransplantHospitalName like
                concat('%', #{transplanthospitalname}, '%')
            </if>
            <if test="transplantdoct != null  and transplantdoct != ''">and TransplantDoct = #{transplantdoct}</if>
            <if test="transplanttime != null ">and TransplantTime = #{transplanttime}</if>
            <if test="abandonreason != null ">and AbandonReason = #{abandonreason}</if>
            <if test="reallocationreason != null ">and ReallocationReason = #{reallocationreason}</if>
            <if test="isbiopsybefore != null ">and IsBiopsyBefore = #{isbiopsybefore}</if>
            <if test="isbiopsyafter != null ">and IsBiopsyAfter = #{isbiopsyafter}</if>
            <if test="ismarginalorgan != null ">and IsMarginalOrgan = #{ismarginalorgan}</if>
            <if test="ispathogenpositive != null ">and IsPathogenPositive = #{ispathogenpositive}</if>
            <if test="ispnf != null ">and IsPNF = #{ispnf}</if>
            <if test="isdgf != null ">and isDGF = #{isdgf}</if>
 
        </where>
    </select>
    <select id="getAllDonateOrgans" resultType="com.ruoyi.project.domain.ServiceDonateorgan">
        <include refid="selectServiceDonateorganVo"/>
    </select>
    <select id="getAllProcessOrgans" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where OrganState = "3"
 
        <if test="starttime != null ">and d.create_time >= #{starttime}</if>
        <if test="endtime != null ">and d.create_time &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getAllFinishedOrgans" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where OrganState = "6" AND d.del_flag=0 AND d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getOrganNo" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where d.del_flag=0 AND d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00' and d.OrganNo = #{organno}
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getAllFinishedOrgansThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
 
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where OrganState = "6" AND d.del_flag=0 AND d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        <if test="starttime != null">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getOrganNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
 
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
 
        where d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        AND d.del_flag=0
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getbiopsyBeforeNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
 
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsBiopsyBefore = "1"
        AND
        d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        AND d.del_flag=0
        <if test="starttime != null">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getbiopsyAfterNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
 
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsBiopsyAfter = "1"
        AND
        d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        AND d.del_flag=0
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getmarginalOrgansNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
 
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsMarginalOrgan = "1" AND
        d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        AND d.del_flag=0
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getPathogenPositiveNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
 
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsPathogenPositive = "1"
        AND
        d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        AND d.del_flag=0
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getPNFNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
 
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsPNF = "1"
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getDGFNumberThisYear" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsDGF = "1"
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="selectPNFOrganThisYear" resultType="com.ruoyi.project.domain.ServiceDonateorgan">
        select * from service_donateorgan d
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsPNF = "1"
        AND
        d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        AND d.del_flag=0
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
 
    </select>
    <select id="selectDGFOrganThisYear" resultType="com.ruoyi.project.domain.ServiceDonateorgan">
        select * from service_donateorgan d
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where IsDGF = "1"
        AND
        d.OrganGetTime IS NOT NULL AND d.OrganNo != 'C00'
        AND d.OrganNo != 'C69L'
        AND d.OrganNo != 'C69R'
        AND d.del_flag=0
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="selectVOList" resultType="com.ruoyi.project.domain.vo.DonateOrganVO">
        SELECT
        `service_donatebaseinfo`.`ID` AS `ID`,
        `service_donatebaseinfo`.`Name` AS `Name`,
        `service_donatebaseinfo`.`Sex` AS `Sex`,
        `service_donatebaseinfo`.`IDCardType` AS `IDCardType`,
        `service_donatebaseinfo`.`IDCardNo` AS `IDCardNo`,
        `service_donatebaseinfo`.`Age` AS `Age`,
        `service_donatebaseinfo`.`AgeUnit` AS `AgeUnit`,
        `service_donatebaseinfo`.`Birthday` AS `Birthday`,
        `service_donatebaseinfo`.`Phone` AS `Phone`,
        `service_donatebaseinfo`.`Nationality` AS `Nationality`,
        `service_donatebaseinfo`.`NativePlace` AS `NativePlace`,
        `service_donatebaseinfo`.`Nation` AS `Nation`,
        `service_donatebaseinfo`.`TreatmentHospitalNo` AS `TreatmentHospitalNo`,
        `service_donatebaseinfo`.`TreatmentHospitalName` AS `TreatmentHospitalName`,
        `service_donatebaseinfo`.`TreatmentDeptName` AS `TreatmentDeptName`,
        `service_donatebaseinfo`.`DiagnosisNo` AS `DiagnosisNo`,
        `service_donatebaseinfo`.`DonorNo` AS `DonorNo`,
        `service_donatebaseinfo`.`PatientState` AS `PatientState`,
        `service_donatebaseinfo`.`ReporterNo` AS `ReporterNo`,
        `service_donatebaseinfo`.`ReporterName` AS `ReporterName`,
        `service_donatebaseinfo`.`ReporterPhone` AS `ReporterPhone`,
        `service_donatebaseinfo`.`ReportTime` AS `ReportTime`,
        `service_donatebaseinfo`.`RecordState` AS `RecordState`,
        `service_donateorgan`.`ID` AS `doID`,
        `service_donateorgan`.`InfoID` AS `InfoID`,
        `service_donateorgan`.`DonorNo` AS `doDonorNo`,
        `service_donateorgan`.`OrganNo` AS `OrganNo`,
        `service_donateorgan`.`OrganName` AS `OrganName`,
        `service_donateorgan`.`OrganState` AS `OrganState`,
        `service_donateorgan`.`OrganNumber` AS `OrganNumber`,
        `service_donateorgan`.`OrganGetTime` AS `OrganGetTime`,
        `service_donateorgan`.`OrganGetDoct` AS `OrganGetDoct`,
        `service_donateorgan`.`GainHospitalNo` AS `GainHospitalNo`,
        `service_donateorgan`.`GainHospitalName` AS `GainHospitalName`,
        `service_donateorgan`.`TransplantHospitalNo` AS `TransplantHospitalNo`,
        `service_donateorgan`.`TransplantHospitalName` AS `TransplantHospitalName`,
        `service_donateorgan`.`TransplantDoct` AS `TransplantDoct`,
        `service_donateorgan`.`TransplantTime` AS `TransplantTime`,
        `service_donateorgan`.`AbandonReason` AS `AbandonReason`,
        `service_donateorgan`.`ReallocationReason` AS `ReallocationReason`,
        `service_donateorgan`.`CaseNo` AS `CaseNo`,
        `service_donateorgan`.`IsBiopsyBefore` AS `IsBiopsyBefore`,
        `service_donateorgan`.`IsBiopsyAfter` AS `IsBiopsyAfter`,
        `service_donateorgan`.`IsMarginalOrgan` AS `IsMarginalOrgan`,
        `service_donateorgan`.`IsPathogenPositive` AS `IsPathogenPositive`,
        `service_donateorgan`.`IsPNF` AS `IsPNF`,
        `service_donateorgan`.`IsDGF` AS `IsDGF`,
        `service_donateorgan`.`del_flag` AS `del_flag`,
        `service_donateorgan`.`create_by` AS `create_by`,
        `service_donateorgan`.`create_time` AS `create_time`,
        `service_donateorgan`.`update_by` AS `update_by`,
        `service_donateorgan`.`update_time` AS `update_time`,
        `service_donatebaseinfo`.`leadername` AS `leadername`,
        `service_donatebaseinfo`.`leaderno` AS `leaderno`,
        `service_donatebaseinfo`.`businessarea` AS `businessarea`
        FROM
        (
        `service_donatebaseinfo`
        JOIN `service_donateorgan` ON ((
        `service_donatebaseinfo`.`ID` = `service_donateorgan`.`InfoID`
        )))
 
        <where>
            <if test="donorno != null  and donorno != ''">and `service_donatebaseinfo`.`DonorNo` = #{donorno}</if>
            <if test="name != null  and name != ''">and `service_donatebaseinfo`.`Name` = #{name}</if>
            <if test="idcardno != null  and idcardno != ''">and `service_donatebaseinfo`.`IDCardNo` = #{idcardno}</if>
            <if test="treatmenthospitalno != null  and treatmenthospitalno != ''">and
                `service_donatebaseinfo`.`TreatmentHospitalNo` = #{treatmenthospitalno}
            </if>
            <if test="recordstate != null  and recordstate != ''">and `service_donatebaseinfo`.`RecordState` =
                #{recordstate}
            </if>
 
            <if test="organno != null  and organno != ''">and `service_donateorgan`.`OrganNo` = #{organno}</if>
            <if test="organname != null  and organname != ''">and `service_donateorgan`.`OrganName` = #{organname}</if>
            <if test="transplanthospitalno != null  and transplanthospitalno != ''">and
                `service_donateorgan`.`TransplantHospitalNo` = #{transplanthospitalno}
            </if>
            <if test="transplanthospitalname != null  and transplanthospitalname != ''">and
                `service_donateorgan`.`TransplantHospitalName` = #{transplanthospitalname}
            </if>
            <if test="organstate != null  and organstate != ''">and `service_donateorgan`.`OrganState` = #{organstate}
            </if>
            <if test="reportername != null  and reportername != ''">and `service_donatebaseinfo`.`ReporterName` =
                #{reportername}
            </if>
            <if test="leadername != null  and leadername != ''">and `service_donatebaseinfo`.`leadername` =
                #{leadername}
            </if>
            <if test="leaderno != null  and leaderno != ''">and `service_donatebaseinfo`.`leaderno` = #{leaderno}</if>
            <if test="businessarea != null  and businessarea != ''">and `service_donatebaseinfo`.`businessarea` =
                #{businessarea}
            </if>
            <if test="gainHospitalname != null  and gainHospitalname != ''">and `service_donateorgan`.`GainHospitalName`
                = #{gainHospitalname}
            </if>
            <if test="treatmenthospitalname != null  and treatmenthospitalname != ''">and
                `service_donatebaseinfo`.`TreatmentHospitalName` = #{treatmenthospitalname}
            </if>
            <if test="startorgangettime != null  and endorgangettime != null ">and `service_donateorgan`.`OrganGetTime`
                >= #{startorgangettime} and `service_donateorgan`.`OrganGetTime` &lt;= #{endorgangettime}
            </if>
            <if test="starttransplanttime != null  and endtransplanttime != null  ">and
                `service_donateorgan`.`TransplantTime` >= #{starttransplanttime} and
                `service_donateorgan`.`TransplantTime` &lt;= #{endtransplanttime}
            </if>
 
        </where>
    </select>
    <select id="countNumber" resultType="java.lang.Integer">
        select count(*)
        from service_donateorgan
        where OrganGetTime >= #{starttime}
          and OrganGetTime &lt;= #{endtime}
          -- (OrganState = "3" or OrganState = "4" or OrganState = "5" or OrganState = "6")
          AND OrganGetTime IS NOT NULL
          AND OrganNo != 'C00'
          AND del_flag=0
    </select>
    <select id="countPeople" resultType="java.lang.Integer">
        select count(distinct (InfoID))
        from service_donateorgan
        where create_time >= #{starttime}
          and create_time &lt;= #{endtime}
    </select>
    <select id="getAllDonateOrgansByTime" resultType="com.ruoyi.project.domain.ServiceDonateorgan">
        <include refid="selectServiceDonateorganVo"/>
        where OrganGetTime >= #{starttime} and OrganGetTime &lt;= #{endtime}
        AND OrganGetTime IS NOT NULL
        -- AND (OrganState = "3" or OrganState = "4" or OrganState = "5" or OrganState = "6")
        AND OrganNo != 'C00'
        AND del_flag=0
    </select>
    <select id="selectServiceDonateorganListNotAbandon" resultMap="ServiceDonateorganResult">
        <include refid="selectServiceDonateorganVo"/>
        where OrganState != "99"
    </select>
 
    <select id="getOrgansCount" resultType="java.lang.Integer">
        select count(*)
        from service_donateorgan
        where TransplantHospitalNo = #{organizationid}
          and del_flag = 0
          and OrganGetTime >= #{starttime}
          and OrganGetTime &lt;= #{endtime}
    </select>
    <select id="getDistinctOrgansCount" resultType="java.lang.Integer">
        select count(*) from service_donateorgan d
        inner join service_donatebaseinfo b on b.id = d.InfoID
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        where d.OrganNo = #{organno}
        -- and (OrganState = "3" or OrganState = "4" or OrganState = "5" or OrganState = "6")
        and d.del_flag=0
        and d.OrganGetTime IS NOT NULL
        <if test="starttime != null ">and d.OrganGetTime >= #{starttime}</if>
        <if test="endtime != null ">and d.OrganGetTime &lt;= #{endtime}</if>
        <if test="city != null and city != ''">and o.City = #{city}</if>
        <if test="reporterno != null and reporterno != ''">and b.ReporterNo = #{reporterno}</if>
    </select>
    <select id="getOrganNameByNo" resultType="java.lang.String">
        select distinct OrganName
        from service_donateorgan
        where OrganNo = #{organno}
    </select>
    <select id="selectAll" resultType="com.ruoyi.project.domain.ServiceDonateorgan">
        <include refid="selectServiceDonateorganVo"/>
        where OrganGetTime > 0 and del_flag = 0
        and OrganGetTime >= #{starttime} and OrganGetTime &lt;= #{endtime}
    </select>
 
 
</mapper>