select service_organallocation.* from service_organallocation
                                                  LEFT JOIN service_donateorgan on service_organallocation.OrganID=service_donateorgan.ID
                                                  LEFT JOIN service_donatebaseinfo on service_donateorgan.InfoID=service_donatebaseinfo.ID
                                                  LEFT JOIN base_organization on base_organization.OrganizationID = service_donatebaseinfo.TreatmentHospitalNo
     
    
         
        
             and service_organallocation.OrganID = #{organid} 
             and service_organallocation.OrganNumber = #{organnumber} 
             and service_organallocation.ApplicantUserID = #{applicantuserid} 
             and service_organallocation.ApplicantUserName like concat('%', #{applicantusername}, '%') 
             and service_organallocation.ApplicantTime = #{applicanttime} 
             and service_organallocation.CheckUserID = #{checkuserid} 
             and service_organallocation.CheckUserName like concat('%', #{checkusername}, '%') 
             and service_organallocation.CheckTime = #{checktime} 
             and service_organallocation.CheckSuggestion = #{checksuggestion} 
             and service_organallocation.AllocationStatus = #{allocationstatus} 
             and service_organallocation.Name like concat('%', #{name}, '%') 
             and service_organallocation.Sex = #{sex} 
             and service_organallocation.IDCardType = #{idcardtype} 
             and service_organallocation.IDCardNo = #{idcardno} 
             and service_organallocation.Age = #{age} 
             and service_organallocation.AgeUnit = #{ageunit} 
             and service_organallocation.Birthday = #{birthday} 
             and service_organallocation.Phone = #{phone} 
             and service_organallocation.ResidenceAddress = #{residenceaddress} 
             and service_organallocation.ResidenceProvince = #{residenceprovince} 
             and service_organallocation.ResidenceProvinceName like concat('%', #{residenceprovincename}, '%') 
             and service_organallocation.ResidenceCity = #{residencecity} 
             and service_organallocation.ResidenceCityName like concat('%', #{residencecityname}, '%') 
             and service_organallocation.ResidenceTown = #{residencetown} 
             and service_organallocation.ResidenceTownName like concat('%', #{residencetownname}, '%') 
             and service_organallocation.ResidenceCommunity = #{residencecommunity} 
             and service_organallocation.ResidenceCommunityName like concat('%', #{residencecommunityname}, '%') 
             and service_organallocation.ResidenceCountyCode = #{residencecountycode} 
             and service_organallocation.ResidenceCountyName like concat('%', #{residencecountyname}, '%') 
             and service_organallocation.create_by = #{createBy} 
             and `service_organallocation`.ApplicantTime >= #{starttime}  
              and `service_organallocation`.ApplicantTime <= #{endtime} 
             and `service_donatebaseinfo`.ReporterNo = #{reporterno} 
             and `base_organization`.`City` = #{city} 
         
        order by create_time desc
     
    
        select count(*) from service_organallocation
        where ApplicantTime >= #{starttime} and ApplicantTime <= #{endtime}