|  | @ -2159,7 +2159,7 @@ public class ImService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 		String  sql = "";
 | 
	
		
			
				|  |  | 		//专家咨询
 | 
	
		
			
				|  |  | 		if("1".equals(type) || "15".equals(type) || type.contains(",")){
 | 
	
		
			
				|  |  | 		if("1".equals(type) || "15".equals(type) || type.contains(",")||"17".equals(type)){
 | 
	
		
			
				|  |  | 			sql = "SELECT " +
 | 
	
		
			
				|  |  | 					"a.id AS \"id\"," +
 | 
	
		
			
				|  |  | 					"a.type AS \"type\"," +
 | 
	
	
		
			
				|  | @ -2194,7 +2194,62 @@ public class ImService {
 | 
	
		
			
				|  |  | 			else if(status ==1){
 | 
	
		
			
				|  |  | 				sql +=" and b.status = 10 ";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
 | 
	
		
			
				|  |  | 				sql += " AND b.doctor='" + doctor + "' ";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			if (!StringUtils.isEmpty(title)) {
 | 
	
		
			
				|  |  | 				title = "%" + title + "%";
 | 
	
		
			
				|  |  | 				sql += " and a.symptoms like '" + title + "'";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			if (!StringUtils.isEmpty(start_time)) {
 | 
	
		
			
				|  |  | 				if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  | 					if (flag) {
 | 
	
		
			
				|  |  | 						sql += " and a.czrq >= str_to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					} else {
 | 
	
		
			
				|  |  | 						sql += " and a.czrq >= to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				} else {
 | 
	
		
			
				|  |  | 					sql += " and a.czrq >= '" + start_time + "'";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			if (!StringUtils.isEmpty(end_time)) {
 | 
	
		
			
				|  |  | 				if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  | 					if (flag) {
 | 
	
		
			
				|  |  | 						sql += " and a.czrq <= str_to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					} else {
 | 
	
		
			
				|  |  | 						sql += " and a.czrq <= to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				} else {
 | 
	
		
			
				|  |  | 					sql += " and a.czrq <= '" + end_time + "'";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			//咨询状态
 | 
	
		
			
				|  |  | 			if (status != 0) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				if (status == 2) {//就诊中
 | 
	
		
			
				|  |  | 					sql += " and b.status = 0 ";
 | 
	
		
			
				|  |  | 				} else if (status == 3) {
 | 
	
		
			
				|  |  | 					sql += " and b.status = 1 ";
 | 
	
		
			
				|  |  | 				} else {
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			//咨询类型
 | 
	
		
			
				|  |  | 			if (!StringUtils.isEmpty(type) && !type.equalsIgnoreCase("0")) {
 | 
	
		
			
				|  |  | 				sql += " AND a.type in (" + type + ")";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			if (!StringUtils.isEmpty(id)) {
 | 
	
		
			
				|  |  | 				sql += " and a.id = '" + id + "'";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql += " ORDER BY a.czrq desc ";
 | 
	
		
			
				|  |  | 		}else {
 | 
	
		
			
				|  |  | 			if (-1 == status&&(type.equalsIgnoreCase("0")||type.equalsIgnoreCase("9"))) {
 | 
	
		
			
				|  |  | 				sql = "SELECT " +
 | 
	
	
		
			
				|  | @ -2391,7 +2446,11 @@ public class ImService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				//咨询类型
 | 
	
		
			
				|  |  | 				if (!StringUtils.isEmpty(type) && !type.equalsIgnoreCase("0")) {
 | 
	
		
			
				|  |  | 					sql += " AND a.type in (" + type + ")";
 | 
	
		
			
				|  |  | 					if("9".equalsIgnoreCase(type)){
 | 
	
		
			
				|  |  | 						sql +=" AND a.type in (9,16)" ;
 | 
	
		
			
				|  |  | 					}else {
 | 
	
		
			
				|  |  | 						sql +=" AND a.type in ("+type+")" ;
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				if (!StringUtils.isEmpty(id)) {
 | 
	
	
		
			
				|  | @ -2522,7 +2581,7 @@ public class ImService {
 | 
	
		
			
				|  |  | 		}*/
 | 
	
		
			
				|  |  | 		String  sql = "";
 | 
	
		
			
				|  |  | 		//专家咨询
 | 
	
		
			
				|  |  | 		if("1".equals(type) || "15".equals(type) || type.contains(",")){
 | 
	
		
			
				|  |  | 		if("1".equals(type) || "15".equals(type) || type.contains(",")||"17".equals(type)){
 | 
	
		
			
				|  |  | 			sql = "SELECT " +
 | 
	
		
			
				|  |  | 					" COUNT(1) AS \"total\" "+
 | 
	
		
			
				|  |  | 					"FROM wlyy_consult a," +
 | 
	
	
		
			
				|  | @ -2536,6 +2595,64 @@ public class ImService {
 | 
	
		
			
				|  |  | 			else if(status ==1){
 | 
	
		
			
				|  |  | 				sql +=" and b.status = 10 ";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)){
 | 
	
		
			
				|  |  | 				sql+=" AND b.doctor='"+doctor+"' ";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			if(!StringUtils.isEmpty(title)){
 | 
	
		
			
				|  |  | 				title="%"+title+"%";
 | 
	
		
			
				|  |  | 				sql +=" and a.symptoms like '"+title+"'";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			if(!StringUtils.isEmpty(start_time)){
 | 
	
		
			
				|  |  | 				if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 					if (flag){
 | 
	
		
			
				|  |  | 						sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}else {
 | 
	
		
			
				|  |  | 						sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql +=" and a.czrq >= '"+start_time+"'";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			if(!StringUtils.isEmpty(end_time)){
 | 
	
		
			
				|  |  | 				if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 					if (flag){
 | 
	
		
			
				|  |  | 						sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}else {
 | 
	
		
			
				|  |  | 						sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql +=" and a.czrq <= '"+end_time+"'";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			//咨询状态
 | 
	
		
			
				|  |  | 			if(status != 0){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				if(status ==2 ){//就诊中
 | 
	
		
			
				|  |  | 					sql +=" and b.status = 0 ";
 | 
	
		
			
				|  |  | 				}else if(status ==3 ){
 | 
	
		
			
				|  |  | 					sql +=" and b.status = 1 ";
 | 
	
		
			
				|  |  | 				}else{}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			//咨询类型
 | 
	
		
			
				|  |  | 			if(!StringUtils.isEmpty(type)&&!type.equalsIgnoreCase("0")){
 | 
	
		
			
				|  |  | 				sql +=" AND a.type in ("+type+")" ;
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			if (!StringUtils.isEmpty(id)) {
 | 
	
		
			
				|  |  | 				sql += " and a.id = '" + id + "'";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql += " ORDER BY a.czrq desc ";
 | 
	
		
			
				|  |  | 		}else{
 | 
	
		
			
				|  |  | 			if (-1 == status&&(type.equalsIgnoreCase("0")||type.equalsIgnoreCase("9"))) {
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -2676,9 +2793,15 @@ public class ImService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				//咨询类型
 | 
	
		
			
				|  |  | 				if(!StringUtils.isEmpty(type)&&!type.equalsIgnoreCase("0")){
 | 
	
		
			
				|  |  | 					sql +=" AND a.type in ("+type+")" ;
 | 
	
		
			
				|  |  | 					if("9".equalsIgnoreCase(type)){
 | 
	
		
			
				|  |  | 						sql +=" AND a.type in (9,16)" ;
 | 
	
		
			
				|  |  | 					}else {
 | 
	
		
			
				|  |  | 						sql +=" AND a.type in ("+type+")" ;
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				if (!StringUtils.isEmpty(id)) {
 | 
	
		
			
				|  |  | 					sql += " and a.id = '" + id + "'";
 | 
	
		
			
				|  |  | 				}
 |