liusheng
2023-10-19 f80df09d8dee5c731cb42d4e3d18f627e32bdaea
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
<?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.ServiceDonatebaseinfoMapper">
    
    <resultMap type="com.ruoyi.project.domain.ServiceDonatebaseinfo" id="ServiceDonatebaseinfoResult">
        <result property="id"    column="ID"    />
        <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="registeraddress"    column="RegisterAddress"    />
        <result property="registerprovince"    column="RegisterProvince"    />
        <result property="registerprovincename"    column="RegisterProvinceName"    />
        <result property="registercity"    column="RegisterCity"    />
        <result property="registercityname"    column="RegisterCityName"    />
        <result property="registertown"    column="RegisterTown"    />
        <result property="registertownname"    column="RegisterTownName"    />
        <result property="registercommunity"    column="RegisterCommunity"    />
        <result property="registercommunityname"    column="RegisterCommunityName"    />
        <result property="registercountycode"    column="RegisterCountyCode"    />
        <result property="registercountyname"    column="RegisterCountyName"    />
        <result property="recordstate"    column="RecordState"    />
        <result property="treatmenthospitalno"    column="TreatmentHospitalNo"    />
        <result property="treatmenthospitalname"    column="TreatmentHospitalName"    />
<!--        <result property="treatmentdeptno"    column="TreatmentDeptNo"    />-->
        <result property="treatmentdeptname"    column="TreatmentDeptName"    />
        <result property="diagnosisno"    column="DiagnosisNo"    />
        <result property="diagnosisname"    column="DiagnosisName"    />
        <result property="bloodtype"    column="BloodType"    />
        <result property="inpatientno"    column="InpatientNo"    />
        <result property="donorno"    column="DonorNo"    />
        <result property="donationcategory"    column="DonationCategory"    />
        <result property="illnessoverview"    column="IllnessOverview"    />
<!--        <result property="malignanttumor"    column="MalignantTumor"    />-->
<!--        <result property="deepcoma"    column="DeepComa"    />-->
<!--        <result property="spontaneousbreathing"    column="SpontaneousBreathing"    />-->
<!--        <result property="istrafficaccident"    column="IsTrafficAccident"    />-->
<!--        <result property="iscriminalcase"    column="IsCriminalCase"    />-->
        <result property="kinship"    column="Kinship"    />
        <result property="selfwill"    column="SelfWill"    />
        <result property="kinshipwill"    column="KinshipWill"    />
        <result property="infosources"    column="InfoSources"    />
        <result property="redorganno"    column="RedOrganNo"    />
        <result property="redorganname"    column="RedOrganName"    />
        <result property="contactperson"    column="ContactPerson"    />
        <result property="contactnumber"    column="ContactNumber"    />
        <result property="contacttime"    column="ContactTime"    />
        <result property="reporterno"    column="ReporterNo"    />
        <result property="reportername"    column="ReporterName"    />
        <result property="reporterphone"    column="ReporterPhone"    />
        <result property="reporttime"    column="ReportTime"    />
        <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="nation"    column="Nation"    />
        <result property="occupation"    column="Occupation"    />
        <result property="education"    column="Education"    />
        <result property="nativeplace"    column="NativePlace"    />
<!--        <result property="annexillnessprofile"    column="AnnexIllnessProfile"    />-->
<!--        <result property="annexdiseaseassessment"    column="AnnexDiseaseAssessment"    />-->
<!--        <result property="annexevaluationopinion"    column="AnnexEvaluationOpinion"    />-->
<!--        <result property="annexbraindeathjudgment"    column="AnnexBrainDeathJudgment"    />-->
<!--        <result property="annexeegreport"    column="AnnexEEGReport"    />-->
<!--        <result property="annexshortlatencyreport"    column="AnnexShortLatencyReport"    />-->
<!--        <result property="annexdopplerreportus"    column="AnnexDopplerReportUS"    />-->
<!--        <result property="annexdeathriskassessment"    column="AnnexDeathRiskAssessment"    />-->
        <result property="infoname"    column="infoName"    />
        <result property="infophone"    column="infoPhone"    />
        <result property="deptid"    column="deptid"    />
        <result property="deptname"    column="deptname"    />
        <result property="leaderno"    column="leaderno"    />
        <result property="leadername"    column="leadername"    />
        <result property="businessarea"    column="businessarea"    />
        <result property="annnexfiles"    column="annnexfiles"    />
 
    </resultMap>
 
    <sql id="selectServiceDonatebaseinfoVo">
   select service_donatebaseinfo.* from service_donatebaseinfo         LEFT JOIN `base_organization` ON `base_organization`.`OrganizationID` = `service_donatebaseinfo`.`TreatmentHospitalNo`
    </sql>
    <update id="updateDonateNumber">
        update service_donatebaseinfo
        set DonorNo = #{updateNumber}
        where ID = #{id}
    </update>
 
    <select id="selectServiceDonatebaseinfoList" parameterType="com.ruoyi.project.domain.ServiceDonatebaseinfo" resultMap="ServiceDonatebaseinfoResult">
        <include refid="selectServiceDonatebaseinfoVo"/>
        <where>
            service_donatebaseinfo.del_flag = 0
            <if test="name != null  and name != ''"> and Name like concat('%', #{name}, '%')</if>
            <if test="sex != null "> and Sex = #{sex}</if>
            <if test="idcardtype != null "> and IDCardType = #{idcardtype}</if>
            <if test="idcardno != null  and idcardno != ''"> and IDCardNo = #{idcardno}</if>
            <if test="age != null "> and Age = #{age}</if>
            <if test="ageunit != null  and ageunit != ''"> and AgeUnit = #{ageunit}</if>
            <if test="birthday != null  and birthday != ''"> and Birthday = #{birthday}</if>
            <if test="phone != null  and phone != ''"> and Phone = #{phone}</if>
            <if test="residenceaddress != null  and residenceaddress != ''"> and ResidenceAddress = #{residenceaddress}</if>
            <if test="residenceprovince != null  and residenceprovince != ''"> and ResidenceProvince = #{residenceprovince}</if>
            <if test="residenceprovincename != null  and residenceprovincename != ''"> and ResidenceProvinceName like concat('%', #{residenceprovincename}, '%')</if>
            <if test="residencecity != null  and residencecity != ''"> and ResidenceCity = #{residencecity}</if>
            <if test="residencecityname != null  and residencecityname != ''"> and ResidenceCityName like concat('%', #{residencecityname}, '%')</if>
            <if test="residencetown != null  and residencetown != ''"> and ResidenceTown = #{residencetown}</if>
            <if test="residencetownname != null  and residencetownname != ''"> and ResidenceTownName like concat('%', #{residencetownname}, '%')</if>
            <if test="residencecommunity != null  and residencecommunity != ''"> and ResidenceCommunity = #{residencecommunity}</if>
            <if test="residencecommunityname != null  and residencecommunityname != ''"> and ResidenceCommunityName like concat('%', #{residencecommunityname}, '%')</if>
            <if test="residencecountycode != null  and residencecountycode != ''"> and ResidenceCountyCode = #{residencecountycode}</if>
            <if test="residencecountyname != null  and residencecountyname != ''"> and ResidenceCountyName like concat('%', #{residencecountyname}, '%')</if>
            <if test="registeraddress != null  and registeraddress != ''"> and RegisterAddress = #{registeraddress}</if>
            <if test="registerprovince != null  and registerprovince != ''"> and RegisterProvince = #{registerprovince}</if>
            <if test="registerprovincename != null  and registerprovincename != ''"> and RegisterProvinceName like concat('%', #{registerprovincename}, '%')</if>
            <if test="registercity != null  and registercity != ''"> and RegisterCity = #{registercity}</if>
            <if test="registercityname != null  and registercityname != ''"> and RegisterCityName like concat('%', #{registercityname}, '%')</if>
            <if test="registertown != null  and registertown != ''"> and RegisterTown = #{registertown}</if>
            <if test="registertownname != null  and registertownname != ''"> and RegisterTownName like concat('%', #{registertownname}, '%')</if>
            <if test="registercommunity != null  and registercommunity != ''"> and RegisterCommunity = #{registercommunity}</if>
            <if test="registercommunityname != null  and registercommunityname != ''"> and RegisterCommunityName like concat('%', #{registercommunityname}, '%')</if>
            <if test="registercountycode != null  and registercountycode != ''"> and RegisterCountyCode = #{registercountycode}</if>
            <if test="registercountyname != null  and registercountyname != ''"> and RegisterCountyName like concat('%', #{registercountyname}, '%')</if>
            <if test="recordstate != null and recordstate != ''"> and RecordState = #{recordstate}</if>
            <if test="treatmenthospitalno != null  and treatmenthospitalno != ''"> and TreatmentHospitalNo = #{treatmenthospitalno}</if>
            <if test="treatmenthospitalname != null  and treatmenthospitalname != ''"> and TreatmentHospitalName like concat('%', #{treatmenthospitalname}, '%')</if>
<!--            <if test="treatmentdeptno != null  and treatmentdeptno != ''"> and TreatmentDeptNo = #{treatmentdeptno}</if>-->
            <if test="treatmentdeptname != null  and treatmentdeptname != ''"> and TreatmentDeptName like concat('%', #{treatmentdeptname}, '%')</if>
            <if test="diagnosisno != null  and diagnosisno != ''"> and DiagnosisNo = #{diagnosisno}</if>
            <if test="diagnosisname != null  and diagnosisname != ''"> and DiagnosisName like concat('%', #{diagnosisname}, '%')</if>
            <if test="bloodtype != null  and bloodtype != ''"> and BloodType = #{bloodtype}</if>
            <if test="inpatientno != null  and inpatientno != ''"> and InpatientNo = #{inpatientno}</if>
            <if test="donorno != null  and donorno != ''"> and DonorNo like concat('%', #{donorno}, '%')</if>
            <if test="donationcategory != null  and donationcategory != ''"> and DonationCategory = #{donationcategory}</if>
            <if test="illnessoverview != null  and illnessoverview != ''"> and IllnessOverview = #{illnessoverview}</if>
<!--            <if test="malignanttumor != null "> and MalignantTumor = #{malignanttumor}</if>-->
<!--            <if test="deepcoma != null "> and DeepComa = #{deepcoma}</if>-->
<!--            <if test="spontaneousbreathing != null "> and SpontaneousBreathing = #{spontaneousbreathing}</if>-->
<!--            <if test="istrafficaccident != null "> and IsTrafficAccident = #{istrafficaccident}</if>-->
<!--            <if test="iscriminalcase != null "> and IsCriminalCase = #{iscriminalcase}</if>-->
            <if test="kinship != null  and kinship != ''"> and Kinship = #{kinship}</if>
            <if test="selfwill != null "> and SelfWill = #{selfwill}</if>
            <if test="kinshipwill != null "> and KinshipWill = #{kinshipwill}</if>
            <if test="infosources != null  and infosources != ''"> and InfoSources = #{infosources}</if>
            <if test="redorganno != null  and redorganno != ''"> and RedOrganNo = #{redorganno}</if>
            <if test="redorganname != null  and redorganname != ''"> and RedOrganName like concat('%', #{redorganname}, '%')</if>
            <if test="contactperson != null  and contactperson != ''"> and ContactPerson = #{contactperson}</if>
            <if test="contactnumber != null  and contactnumber != ''"> and ContactNumber = #{contactnumber}</if>
            <if test="contacttime != null  and contacttime != ''"> and ContactTime = #{contacttime}</if>
            <if test="reporterno != null  and reporterno != ''"> and ReporterNo = #{reporterno}</if>
            <if test="reportername != null  and reportername != ''"> and ReporterName like concat('%', #{reportername}, '%')</if>
            <if test="reporterphone != null  and reporterphone != ''"> and ReporterPhone = #{reporterphone}</if>
            <if test="reporttime != null "> and ReportTime = #{reporttime}</if>
<!--            <if test="annexillnessprofile != null  and annexillnessprofile != ''"> and AnnexIllnessProfile = #{annexillnessprofile}</if>-->
<!--            <if test="annexdiseaseassessment != null  and annexdiseaseassessment != ''"> and AnnexDiseaseAssessment = #{annexdiseaseassessment}</if>-->
<!--            <if test="annexevaluationopinion != null  and annexevaluationopinion != ''"> and AnnexEvaluationOpinion = #{annexevaluationopinion}</if>-->
<!--            <if test="annexbraindeathjudgment != null  and annexbraindeathjudgment != ''"> and AnnexBrainDeathJudgment = #{annexbraindeathjudgment}</if>-->
<!--            <if test="annexeegreport != null  and annexeegreport != ''"> and AnnexEEGReport = #{annexeegreport}</if>-->
<!--            <if test="annexshortlatencyreport != null  and annexshortlatencyreport != ''"> and AnnexShortLatencyReport = #{annexshortlatencyreport}</if>-->
<!--            <if test="annexdopplerreportus != null  and annexdopplerreportus != ''"> and AnnexDopplerReportUS = #{annexdopplerreportus}</if>-->
<!--            <if test="annexdeathriskassessment != null  and annexdeathriskassessment != ''"> and AnnexDeathRiskAssessment = #{annexdeathriskassessment}</if>-->
            <if test="infoname != null "> and infoName = #{infoname}</if>
            <if test="infophone != null "> and infoPhone = #{infophone}</if>
            <if test="createBy != null "> and `service_donatebaseinfo`.create_by = #{createBy}</if>
            <if test="starttime != null "> and ReportTime >= #{starttime} </if>
            <if test="endtime != null ">  and  ReportTime &lt;= #{endtime}</if>
            <if test="nativeplace != null  and nativeplace != ''"> and NativePlace = #{nativeplace}</if>
            <if test="city != null and city != ''"> and `base_organization`.`City` = #{city}</if>
            <if test="deptid != null "> and deptid = #{deptid}</if>
            <if test="deptname != null "> and deptname = #{deptname}</if>
            <if test="leaderno != null "> and leaderno = #{leaderno}</if>
            <if test="leadername != null "> and leadername = #{leadername}</if>
            <if test="businessarea != null "> and businessarea = #{businessarea}</if>
        </where>
 
        order by ReportTime desc
 
    </select>
 
    <select id="getDonateNumberById" resultType="java.lang.String">
        select DonorNo from service_donatebaseinfo
        where id = #{id}
    </select>
 
    <select id="getDonateCount" resultType="java.lang.Integer">
        select count(*) from service_donatebaseinfo
        where RecordState = "9"
 
    </select>
    <select id="getDonateBaseCountThisYear" resultType="java.lang.Integer">
        select count(*) from service_donatebaseinfo b
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        <where>
                                              AND  b.del_flag=0
        <if test="starttime != null "> and b.ReportTime >= #{starttime} </if>
        <if test="endtime != null ">  and b.ReportTime &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>
        </where>
    </select>
    <select id="countNumber" resultType="java.lang.Integer">
        select count(*) from service_donatebaseinfo
        where ReportTime >= #{starttime} and ReportTime &lt;= #{endtime}
    </select>
    <select id="getBloodCode" resultType="java.lang.String">
        select BloodCode from base_bloodtype
        where BloodType = #{bloodtype}
    </select>
    <select id="countTerminatedNumber" resultType="java.lang.Integer">
        select count(*) from service_donatebaseinfo
        where RecordState = "99"
        and ReportTime >= #{starttime} and ReportTime &lt;= #{endtime}
    </select>
    <select id="getAllDonateBaseInfo" resultType="com.ruoyi.project.domain.ServiceDonatebaseinfo">
        <include refid="selectServiceDonatebaseinfoVo"/>
    </select>
    <select id="getBaseInfoByHospital" resultType="com.ruoyi.project.domain.ServiceDonatebaseinfo">
        select ID, ReportTime from service_donatebaseinfo
        where TreatmentHospitalNo = #{organizationid}
    </select>
    <select id="getAllDonateBaseInfoByTime" resultType="com.ruoyi.project.domain.ServiceDonatebaseinfo">
        select * from service_donatebaseinfo b
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        <where>
        <if test="starttime != null "> and b.ReportTime >= #{starttime} </if>
        <if test="endtime != null ">  and b.ReportTime &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>
        </where>
    </select>
    <select id="listForSearch" resultType="com.ruoyi.project.domain.ServiceDonatebaseinfo">
        <include refid="selectServiceDonatebaseinfoVo"/>
        <where>
            <if test="name != null and name != ''"> Name like concat('%', #{name}, '%')
            or idcardno like concat('%', #{name}, '%')
            or treatmenthospitalname like concat('%', #{name}, '%')
           or residenceprovincename like concat('%', #{name}, '%')
             or residencecityname like concat('%', #{name}, '%')
           or residencetownname like concat('%', #{name}, '%')
             or bloodtype like concat('%', #{name}, '%')
            or nativeplace like concat('%', #{name}, '%')
            or reportername like concat('%', #{name}, '%')</if>
 
        </where>
    </select>
    <select id="getDonorNameById" resultType="java.lang.String">
        select name from service_donatebaseinfo
        where id = #{infoid}
    </select>
    <select id="gethqzz" resultType="java.lang.String">
        select AcquisitionTissueName from service_donatebaseinfo
        where id = #{infoid}
    </select>
    <select id="getById" resultType="com.ruoyi.project.domain.ServiceDonatebaseinfo">
        select * from service_donatebaseinfo
        where id = #{infoid}
    </select>
    <select id="countByRecordState" resultType="java.lang.Integer">
        select count(*) from service_donatebaseinfo
        where RecordState = #{recordState}
        and ReportTime >= #{starttime} and ReportTime &lt;= #{endtime}
    </select>
    <select id="getDistrictDonate" resultType="java.lang.String">
        select o.city from service_donatebaseinfo b
        inner join base_organization o on o.organizationid=b.treatmenthospitalno
        where (b.RecordState = '0' or b.RecordState = '1' or b.RecordState = '2')
    </select>
    <select id="getDistrictComplete" resultType="java.lang.String">
        select o.city from service_donatebaseinfo b
        inner join service_donatecompletioninfo d on d.infoid=b.id
        inner join base_organization o on o.organizationid=b.treatmenthospitalno
        where d.CompleteTime > 0
    </select>
    <select id="getDistrictOrgans" resultType="java.lang.String">
        select o.city from service_donatebaseinfo b
        inner join service_donateorgan d on d.infoid=b.id
        inner join base_organization o on o.organizationid=b.treatmenthospitalno
        where d.OrganGetTime > 0
    </select>
    <select id="getDonateNameById" resultType="java.lang.String">
        select Name from service_donatebaseinfo
        where id = #{infoid}
    </select>
 
    <select id="getDistrictDonateByTime" resultType="java.lang.String">
        select o.city from service_donatebaseinfo b
                               inner join base_organization o on o.organizationid=b.treatmenthospitalno
        where (b.RecordState = '0' or b.RecordState = '1' or b.RecordState = '2')
            and b.ReportTime >= #{starttime} and b.ReportTime &lt;= #{endtime}
    </select>
    <select id="getDistrictCompleteByTime" resultType="java.lang.String">
        select o.city from service_donatebaseinfo b
                               inner join service_donatecompletioninfo d on d.infoid=b.id
                               inner join base_organization o on o.organizationid=b.treatmenthospitalno
        where d.del_flag=0  and d.CompleteTime >= #{starttime} and d.CompleteTime &lt;= #{endtime}
    </select>
 
    <select id="gettreatmenthospitalnoCompleteByTime" resultType="java.lang.String">
        select b.treatmenthospitalno from service_donatebaseinfo b
                               inner join service_donatecompletioninfo d on d.infoid=b.id
                               inner join base_organization o on o.organizationid=b.treatmenthospitalno
        <where>
            d.del_flag=0
            <if test="starttime != null "> and d.CompleteTime >= #{starttime} </if>
            <if test="endtime != null ">  and d.CompleteTime &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>
        </where>
    </select>
 
    <select id="getDistrictOrgansByTime" resultType="java.lang.String">
        select o.city from service_donatebaseinfo b
                               inner join service_donateorgan d on d.infoid=b.id
                               inner join base_organization o on o.organizationid=b.treatmenthospitalno
        WHERE d.del_flag=0  AND d.OrganGetTime IS NOT NULL AND d.OrganGetTime >= #{starttime} AND d.OrganGetTime &lt;= #{endtime}
    </select>
 
</mapper>