liusheng
2024-08-02 b9cc263b8d1d31608a4c16cd157cc84b51e3d29d
ruoyi-project/src/main/resources/mapper/project/ServiceDonateorganMapper.xml
@@ -1,69 +1,182 @@
<?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">
        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="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="estimatedtime" column="EstimatedTime"/>
        <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, 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 from service_donateorgan
        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,
               EstimatedTime,
               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">
    <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>
            <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="estimatedtime != null ">and EstimatedTime = #{estimatedtime}</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>
@@ -76,58 +189,87 @@
        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>
        <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>
        <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>
        <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
        <!--        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 count(*) from service_donatecomporgan 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'
        where b.del_flag=0
        AND d.del_flag=0
        AND d.TransplantTime 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>
        <if test="transplantstate != null">and d.transplantstate >= #{transplantstate}</if>
        <if test="starttime != null">and d.TransplantTime >= #{starttime}</if>
        <if test="endtime != null ">and d.TransplantTime &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
        <!--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 count(*) from service_donationwitnessorgan 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'
        where b.del_flag=0
        AND d.OrganGetTime IS NOT NULL
        AND d.OrganState=1
        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>
        <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
@@ -140,10 +282,10 @@
        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>
        <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
@@ -156,25 +298,25 @@
        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>
        <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
        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
        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>
        <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
@@ -187,10 +329,10 @@
        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>
        <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
@@ -198,20 +340,20 @@
        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>
        <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>
        <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
@@ -223,10 +365,10 @@
        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>
        <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">
@@ -239,13 +381,13 @@
        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>
        <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
        SELECT
        `service_donatebaseinfo`.`ID` AS `ID`,
        `service_donatebaseinfo`.`Name` AS `Name`,
        `service_donatebaseinfo`.`Sex` AS `Sex`,
@@ -301,54 +443,81 @@
        `service_donatebaseinfo`.`leadername` AS `leadername`,
        `service_donatebaseinfo`.`leaderno` AS `leaderno`,
        `service_donatebaseinfo`.`businessarea` AS `businessarea`
    FROM
        FROM
        (
            `service_donatebaseinfo`
            JOIN `service_donateorgan` ON ((
                `service_donatebaseinfo`.`ID` = `service_donateorgan`.`InfoID`
        `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="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>
            <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")
        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 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 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 (OrganState = "3" or OrganState = "4" or OrganState = "5" or OrganState = "6")
        AND OrganNo != 'C00'
        AND del_flag=0
    </select>
@@ -358,25 +527,29 @@
    </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 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
    <select id="getDistinctOrgansCount" resultType="com.ruoyi.project.domain.vo.DistinctOrgansCount">
        select count(*) as gainsum,ifnull(sum( CASE WHEN transplantstate = 3 THEN 1 ELSE 0 END ),0) as abandonCount from service_donatecomporgan 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>
        and d.del_flag=0 and b.del_flag = 0 and b.workflow>5
        -- and d.OrganGetTime IS NOT NULL
        <if test="starttime != null ">and b.donatetime >= #{starttime}</if>
        <if test="endtime != null ">and b.donatetime &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
        select distinct OrganName
        from service_donateorgan
        where OrganNo = #{organno}
    </select>
    <select id="selectAll" resultType="com.ruoyi.project.domain.ServiceDonateorgan">
@@ -385,5 +558,91 @@
        and OrganGetTime >= #{starttime} and OrganGetTime &lt;= #{endtime}
    </select>
    <select id="countList" parameterType="com.ruoyi.project.domain.ServiceOrganallocation"
            resultMap="ServiceDonateorganResult">
        select service_donateorgan.* from service_donateorgan
        LEFT JOIN service_donatebaseinfo on service_donateorgan.InfoID=service_donatebaseinfo.ID
        LEFT JOIN base_organization on base_organization.OrganizationID = service_donatebaseinfo.TreatmentHospitalNo
        <where>
            <if test="id != null ">and service_donateorgan.ID = #{id}</if>
            <if test="organnumber != null  and organnumber != ''">and service_donateorgan.OrganNumber = #{organnumber}
            </if>
            <if test="applicantuserid != null  and applicantuserid != ''">and service_donateorgan.ApplicantUserID =
                #{applicantuserid}
            </if>
            <if test="applicantusername != null  and applicantusername != ''">and service_donateorgan.ApplicantUserName
                like
                concat('%', #{applicantusername}, '%')
            </if>
            <if test="applicanttime != null ">and service_donateorgan.ApplicantTime = #{applicanttime}</if>
            <if test="checkuserid != null  and checkuserid != ''">and service_donateorgan.CheckUserID = #{checkuserid}
            </if>
            <if test="checkusername != null  and checkusername != ''">and service_donateorgan.CheckUserName like
                concat('%',
                #{checkusername}, '%')
            </if>
            <if test="checktime != null ">and service_donateorgan.CheckTime = #{checktime}</if>
            <if test="checksuggestion != null  and checksuggestion != ''">and service_donateorgan.CheckSuggestion =
                #{checksuggestion}
            </if>
            <if test="allocationstatus != null ">and service_donateorgan.AllocationStatus = #{allocationstatus}</if>
            <if test="name != null  and name != ''">and service_donateorgan.Name like concat('%', #{name}, '%')</if>
            <if test="sex != null ">and service_donateorgan.Sex = #{sex}</if>
            <if test="idcardtype != null ">and service_donateorgan.IDCardType = #{idcardtype}</if>
            <if test="idcardno != null  and idcardno != ''">and service_donateorgan.IDCardNo = #{idcardno}</if>
            <if test="age != null ">and service_donateorgan.Age = #{age}</if>
            <if test="ageunit != null  and ageunit != ''">and service_donateorgan.AgeUnit = #{ageunit}</if>
            <if test="birthday != null  and birthday != ''">and service_donateorgan.Birthday = #{birthday}</if>
            <if test="phone != null  and phone != ''">and service_donateorgan.Phone = #{phone}</if>
            <if test="residenceaddress != null  and residenceaddress != ''">and service_donateorgan.ResidenceAddress =
                #{residenceaddress}
            </if>
            <if test="residenceprovince != null  and residenceprovince != ''">and service_donateorgan.ResidenceProvince
                =
                #{residenceprovince}
            </if>
            <if test="residenceprovincename != null  and residenceprovincename != ''">and
                service_donateorgan.ResidenceProvinceName like concat('%', #{residenceprovincename}, '%')
            </if>
            <if test="residencecity != null  and residencecity != ''">and service_donateorgan.ResidenceCity =
                #{residencecity}
            </if>
            <if test="residencecityname != null  and residencecityname != ''">and service_donateorgan.ResidenceCityName
                like
                concat('%', #{residencecityname}, '%')
            </if>
            <if test="residencetown != null  and residencetown != ''">and service_donateorgan.ResidenceTown =
                #{residencetown}
            </if>
            <if test="residencetownname != null  and residencetownname != ''">and service_donateorgan.ResidenceTownName
                like
                concat('%', #{residencetownname}, '%')
            </if>
            <if test="residencecommunity != null  and residencecommunity != ''">and
                service_donateorgan.ResidenceCommunity =
                #{residencecommunity}
            </if>
            <if test="residencecommunityname != null  and residencecommunityname != ''">and
                service_donateorgan.ResidenceCommunityName like concat('%', #{residencecommunityname}, '%')
            </if>
            <if test="residencecountycode != null  and residencecountycode != ''">and
                service_donateorgan.ResidenceCountyCode =
                #{residencecountycode}
            </if>
            <if test="residencecountyname != null  and residencecountyname != ''">and
                service_donateorgan.ResidenceCountyName
                like concat('%', #{residencecountyname}, '%')
            </if>
            <if test="createBy != null  and createBy != ''">and service_donateorgan.create_by = #{createBy}</if>
            <if test="starttime != null ">and `service_donateorgan`.ApplicantTime >= #{starttime}</if>
            <if test="endtime != null ">and `service_donateorgan`.ApplicantTime &lt;= #{endtime}</if>
            <if test="reporterno != null  and reporterno != ''">and `service_donatebaseinfo`.ReporterNo =
                #{reporterno}
            </if>
            <if test="city != null and city != ''">and `base_organization`.`City` = #{city}</if>
        </where>
</mapper>
        order by create_time desc
    </select>
</mapper>