${IF(送审结束否="", "SELECTmshipno AS shipno,dwg1,dwg2,dwg3,"+船号_BASESHIP+".dwgno,chuturi,"+船号_cd+".altno,ship1,songsri,fangqri,rusri,wancri,xwfqri,commt,reply,commtfile,replyfile,closed,cr,bzFROM"+船号_BASESHIP+"LEFT OUTER JOIN"+船号_cd+"ON"+船号_cd+".dwgno="+船号_BASESHIP+".dwgnoWHERE(chuand='Y' OR chuand='R')"+ IF(LEN(图号)=0,"","AND "+船号+".dwgno LIKE '%"+图号+"%'") + IF(LEN(返却状态)=0,"","AND (fangqri IS NULL AND xwfqri IS NULL) OR (fangqri IS NULL AND DATEDIFF(day,xwfqri,getdate())>0)") + IF(LEN(开始日期)=0,"","AND "+船号_cd+".songsri>='"+开始日期+"'") + IF(LEN(结束日期)=0,"","AND "+船号_cd+".songsri<='"+结束日期+"'") + IF(LEN(科室)=0,"","AND "+船号_BASESHIP+".bm IN ('"+SUBSTITUTE(科室,",","','")+"')") +\"ORDER BY mshipno,\"船号_cd\".altno,\"船号_cd\".ship1\", "SELECTshipno,dwg1,dwg2,dwg3,"+船号_BASESHIP+".dwgno,chuturi,"+船号+"_cd.altno,ship1,songsri,fangqri,rusri,wancri,xwfqri,commt,reply,commtfile,replyfile,closed,cr,bzFROM"+船号+"_cd,"+船号_BASESHIP+"WHERE"+船号+"_cd.closed LIKE '%"+送审结束否+"%'AND "+船号+"_cd.dwgno="+船号_BASESHIP+".dwgno"+ IF(LEN(图号)=0,"","AND "+船号+"_cd.dwgno LIKE '%"+图号+"%'") + IF(LEN(返却状态)=0,"","AND (fangqri IS NULL AND xwfqri IS NULL) OR (fangqri IS NULL AND DATEDIFF(day,xwfqri,getdate()) >0)") + IF(LEN(开始日期)=0,"","AND "+船号_cd+".songsri>='"+开始日期+"'") + IF(LEN(结束日期)=0,"","AND "+船号_cd+".songsri<='"+结束日期+"'") + IF(LEN(科室)=0,"","AND "+船号_BASESHIP+".bm IN ('"+SUBSTITUTE(科室,",","','")+"') "))} 33