select service_donatebaseinfo.*
        from service_donatebaseinfo
                 LEFT JOIN `base_organization`
                           ON `base_organization`.`OrganizationID` = `service_donatebaseinfo`.`TreatmentHospitalNo`
     
    
        update service_donatebaseinfo
        set DonorNo = #{updateNumber}
        where ID = #{id}
     
    
         
        
            service_donatebaseinfo.del_flag = 0
            and Name like concat('%', #{name}, '%') 
            and Sex = #{sex} 
            and IDCardType = #{idcardtype} 
            and IDCardNo = #{idcardno} 
            and Age = #{age} 
            and AgeUnit = #{ageunit} 
            and Birthday = #{birthday} 
            and Phone = #{phone} 
            and ResidenceAddress = #{residenceaddress}
             
            and ResidenceProvince =
                #{residenceprovince}
             
            and termination_case =
                #{terminationCase}
             
            and ResidenceProvinceName like
                concat('%', #{residenceprovincename}, '%')
             
            and ResidenceCity = #{residencecity} 
            and ResidenceCityName like concat('%',
                #{residencecityname}, '%')
             
            and ResidenceTown = #{residencetown} 
            and ResidenceTownName like concat('%',
                #{residencetownname}, '%')
             
            and ResidenceCommunity =
                #{residencecommunity}
             
            and ResidenceCommunityName like
                concat('%', #{residencecommunityname}, '%')
             
            and ResidenceCountyCode =
                #{residencecountycode}
             
            and ResidenceCountyName like
                concat('%', #{residencecountyname}, '%')
             
            and RegisterAddress = #{registeraddress} 
            and RegisterProvince = #{registerprovince}
             
            and RegisterProvinceName like
                concat('%', #{registerprovincename}, '%')
             
            and RegisterCity = #{registercity} 
            and RegisterCityName like concat('%',
                #{registercityname}, '%')
             
            and RegisterTown = #{registertown} 
            and RegisterTownName like concat('%',
                #{registertownname}, '%')
             
            and RegisterCommunity =
                #{registercommunity}
             
            and RegisterCommunityName like
                concat('%', #{registercommunityname}, '%')
             
            and RegisterCountyCode =
                #{registercountycode}
             
            and RegisterCountyName like concat('%',
                #{registercountyname}, '%')
             
            and RecordState = #{recordstate} 
            and TreatmentHospitalNo =
                #{treatmenthospitalno}
             
            and TreatmentHospitalName like
                concat('%', #{treatmenthospitalname}, '%')
             
            
            and TreatmentDeptName like concat('%',
                #{treatmentdeptname}, '%')
             
            and DiagnosisNo = #{diagnosisno} 
            and DiagnosisName like concat('%',
                #{diagnosisname}, '%')
             
            and BloodType = #{bloodtype} 
            and InpatientNo = #{inpatientno} 
            and DonorNo like concat('%', #{donorno}, '%') 
            and DonationCategory = #{donationcategory}
             
            and IllnessOverview = #{illnessoverview} 
            and Kinship = #{kinship} 
            and SelfWill = #{selfwill} 
            and KinshipWill = #{kinshipwill} 
            and InfoSources = #{infosources} 
            and RedOrganNo = #{redorganno} 
            and RedOrganName like concat('%', #{redorganname},
                '%')
             
            and ContactPerson = #{contactperson} 
            and ContactNumber = #{contactnumber} 
            and ContactTime = #{contacttime} 
            and ReporterNo = #{reporterno} 
            and ReporterName like concat('%', #{reportername},
                '%')
             
            and ReporterPhone = #{reporterphone} 
            and ReportTime = #{reporttime} 
            and infoName = #{infoname} 
            and infoPhone = #{infophone} 
            and `service_donatebaseinfo`.create_by = #{createBy} 
            and donatetime >= #{starttime} 
            and donatetime <= #{endtime} 
            and NativePlace = #{nativeplace} 
            and `base_organization`.`City` = #{city} 
            and deptid = #{deptid} 
            and deptname = #{deptname} 
            and leaderno = #{leaderno} 
            and leadername = #{leadername} 
            and businessarea = #{businessarea} 
            and donatetime = #{donatetime} 
            and donateno = #{donateno} 
            and workflow = #{workflow} 
         
        order by ReportTime desc
     
    
        select DonorNo
        from service_donatebaseinfo
        where id = #{id}
     
    
        select count(*)
        from service_donatebaseinfo
        where RecordState = "9"
     
    
        select count(*) from service_donatebaseinfo b
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        
            AND b.del_flag=0
            and b.donatetime >= #{starttime} 
            and b.donatetime <= #{endtime} 
            and o.City = #{city} 
            and b.ReporterNo = #{reporterno} 
         
     
    
        select count(*)
        from service_donatebaseinfo
        where ReportTime >= #{starttime}
          and ReportTime <= #{endtime}
     
    
        select BloodCode
        from base_bloodtype
        where BloodType = #{bloodtype}
     
    
        select count(*)
        from service_donatebaseinfo
        where RecordState = "99"
          and ReportTime >= #{starttime}
          and ReportTime <= #{endtime}
     
    
         
     
    
        select ID, ReportTime
        from service_donatebaseinfo
        where TreatmentHospitalNo = #{organizationid}
     
    
        select * from service_donatebaseinfo b
        inner join base_organization o on b.TreatmentHospitalNo = o.OrganizationID
        
            and b.ReportTime >= #{starttime} 
            and b.ReportTime <= #{endtime} 
            and o.City = #{city} 
            and b.ReporterNo = #{reporterno} 
         
     
    
         
        
            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}, '%')
             
         
     
    
        select name
        from service_donatebaseinfo
        where id = #{infoid}
     
    
        select AcquisitionTissueName
        from service_donatebaseinfo
        where id = #{infoid}
     
    
        select *
        from service_donatebaseinfo
        where id = #{infoid}
     
    
        select count(*)
        from service_donatebaseinfo
        where RecordState = #{recordState}
          and ReportTime >= #{starttime}
          and ReportTime <= #{endtime}
     
    
        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 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 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 Name
        from service_donatebaseinfo
        where id = #{infoid}
     
    
        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 <= #{endtime}
     
    
        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 <= #{endtime}
     
    
        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
        
            d.del_flag=0
            and d.CompleteTime >= #{starttime} 
            and d.CompleteTime <= #{endtime} 
            and o.City = #{city} 
            and b.ReporterNo = #{reporterno} 
         
     
    
        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 <= #{endtime}