select plan.dep_name,plan.name as planName,contract.name as contractName,plan.servicetype from t_b_contract contract ,t_b_maintain_plan plan where contract.signdate between :contractStartTime and :contractEndTime and contract.bpm_status='3' and plan.bpm_status='3' and plan.contract_id is null and plan.depart_id = contract.projectid and exists(select 1 from t_b_contract_item item ,t_b_project_service service where contract.id=item.contractid and item.serviceid=service.id and plan.servicetype = service.servicetypedetail )