|  | @ -132,7 +132,8 @@ public class ConsultService {
 | 
	
		
			
				|  |  |      * @param doctorName 医生名字
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status,String doctorName) {
 | 
	
		
			
				|  |  |     public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page
 | 
	
		
			
				|  |  |             ,int pagesize, String title, String symptoms,Integer status,String doctorName) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String  sql = "SELECT " +
 | 
	
		
			
				|  |  |                 "a.id AS \"id\"," +
 | 
	
	
		
			
				|  | @ -161,10 +162,13 @@ public class ConsultService {
 | 
	
		
			
				|  |  |             title="%"+title+"%";
 | 
	
		
			
				|  |  |             sql +=" and a.title like '"+title+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(symptoms)){
 | 
	
		
			
				|  |  |             symptoms="%"+symptoms+"%";
 | 
	
		
			
				|  |  |             sql +=" and a.symptoms like '"+symptoms+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(doctorName)){
 | 
	
		
			
				|  |  |             title="%"+doctorName+"%";
 | 
	
		
			
				|  |  |             sql +=" and d.name like '"+title+"'";
 | 
	
		
			
				|  |  |             doctorName="%"+doctorName+"%";
 | 
	
		
			
				|  |  |             sql +=" and d.name like '"+doctorName+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //咨询状态
 | 
	
	
		
			
				|  | @ -182,6 +186,109 @@ public class ConsultService {
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询患者所有的咨询记录总数
 | 
	
		
			
				|  |  |      * @param patient 患者标识
 | 
	
		
			
				|  |  |      * @param id 会话ID(等同IM表topicId)
 | 
	
		
			
				|  |  |      * @param type 咨询会话类型
 | 
	
		
			
				|  |  |      * @param title 标题关键字
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Long countConsultRecordByPatient(String patient, String id,String type, String title,String symptoms,String doctorName,Integer status) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String  sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) AS \"total\" " +
 | 
	
		
			
				|  |  |                 "FROM wlyy_consult a," +
 | 
	
		
			
				|  |  |                 "wlyy_consult_team b," +
 | 
	
		
			
				|  |  |                 "base_doctor d " +
 | 
	
		
			
				|  |  |                 "WHERE a.id=b.consult " +
 | 
	
		
			
				|  |  |                 "AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+") ";
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(title)){
 | 
	
		
			
				|  |  |             title="%"+title+"%";
 | 
	
		
			
				|  |  |             sql +=" and a.title like '"+title+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(symptoms)){
 | 
	
		
			
				|  |  |             symptoms="%"+symptoms+"%";
 | 
	
		
			
				|  |  |             sql +=" and a.symptoms like '"+symptoms+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(doctorName)){
 | 
	
		
			
				|  |  |             doctorName="%"+doctorName+"%";
 | 
	
		
			
				|  |  |             sql +=" and d.name like '"+doctorName+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //咨询状态
 | 
	
		
			
				|  |  |         if(status != null && status != 0){
 | 
	
		
			
				|  |  |             sql +=" and b.status ="+status;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(id)) {
 | 
	
		
			
				|  |  |             sql += " and a.id = '" + id + "'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         Long count = 0L;
 | 
	
		
			
				|  |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
	
		
			
				|  |  |             count = Long.parseLong(rstotal.get(0).get("total").toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return count;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询患者所有的咨询记录总数
 | 
	
		
			
				|  |  |      * @param doctor 患者标识
 | 
	
		
			
				|  |  |      * @param id 会话ID(等同IM表topicId)
 | 
	
		
			
				|  |  |      * @param type 咨询会话类型
 | 
	
		
			
				|  |  |      * @param symptoms 标题关键字
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Long countConsultRecordByDoctor(String doctor, String id,String type, String symptoms,Integer status,String start_time,String end_time,String name) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String  sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " COUNT(1) AS \"total\" " +
 | 
	
		
			
				|  |  |                 "FROM wlyy_consult a," +
 | 
	
		
			
				|  |  |                 "wlyy_consult_team b," +
 | 
	
		
			
				|  |  |                 "base_patient d " +
 | 
	
		
			
				|  |  |                 "WHERE a.id=b.consult " +
 | 
	
		
			
				|  |  |                 "AND b.patient=d.id AND b.doctor='"+doctor+"' AND a.type in ("+type+") ";
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(symptoms)) {
 | 
	
		
			
				|  |  |             symptoms = "%" + symptoms + "%";
 | 
	
		
			
				|  |  |             sql += " and a.symptoms like '" + symptoms + "'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(name)) {
 | 
	
		
			
				|  |  |             name = "%" + name + "%";
 | 
	
		
			
				|  |  |             sql += " and b.name like '" + name + "'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(start_time)) {
 | 
	
		
			
				|  |  |             sql += " and a.czrq >= '" + start_time + "'";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(end_time)) {
 | 
	
		
			
				|  |  |             sql += " and a.czrq <= '" + end_time + "'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //咨询状态
 | 
	
		
			
				|  |  |         if (status != null) {
 | 
	
		
			
				|  |  |             sql += " and b.status = "+status;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //咨询类型
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(type)) {
 | 
	
		
			
				|  |  |             sql += " AND a.type in (" + type + ")";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(id)) {
 | 
	
		
			
				|  |  |             sql += " and a.id = '" + id + "'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         Long count = 0L;
 | 
	
		
			
				|  |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
	
		
			
				|  |  |             count = Long.parseLong(rstotal.get(0).get("total").toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return count;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询医生所有的咨询记录
 | 
	
		
			
				|  |  |      * @param doctor 医生标识
 | 
	
	
		
			
				|  | @ -189,7 +296,7 @@ public class ConsultService {
 | 
	
		
			
				|  |  |      * @param type 咨询会话类型 : 0 全部
 | 
	
		
			
				|  |  |      * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
 | 
	
		
			
				|  |  |      * @param pagesize 分页大小
 | 
	
		
			
				|  |  |      * @param title 标题关键字
 | 
	
		
			
				|  |  |      * @param symptoms 标题关键字
 | 
	
		
			
				|  |  |      * @param start_time 开始时间
 | 
	
		
			
				|  |  |      * @param end_time 结束时间
 | 
	
		
			
				|  |  |      * @return
 | 
	
	
		
			
				|  | @ -197,7 +304,7 @@ public class ConsultService {
 | 
	
		
			
				|  |  |     public List<Map<String,Object>>  findConsultRecordByDoctor(String doctor, String id,
 | 
	
		
			
				|  |  |                                                                String type, Integer status,
 | 
	
		
			
				|  |  |                                                                int page,int pagesize,
 | 
	
		
			
				|  |  |                                                                String title,String start_time,String end_time) {
 | 
	
		
			
				|  |  |                                                                String symptoms,String start_time,String end_time,String name) {
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                     "a.id AS \"id\"," +
 | 
	
		
			
				|  |  |                     "a.type AS \"type\"," +
 | 
	
	
		
			
				|  | @ -222,9 +329,9 @@ public class ConsultService {
 | 
	
		
			
				|  |  |                 sql += " AND b.doctor='" + doctor + "' ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if (!StringUtils.isEmpty(title)) {
 | 
	
		
			
				|  |  |                 title = "%" + title + "%";
 | 
	
		
			
				|  |  |                 sql += " and a.symptoms like '" + title + "'";
 | 
	
		
			
				|  |  |             if (!StringUtils.isEmpty(symptoms)) {
 | 
	
		
			
				|  |  |                 symptoms = "%" + symptoms + "%";
 | 
	
		
			
				|  |  |                 sql += " and a.symptoms like '" + symptoms + "'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (!StringUtils.isEmpty(start_time)) {
 | 
	
		
			
				|  |  |                 sql += " and a.czrq >= '" + start_time + "'";
 | 
	
	
		
			
				|  | @ -422,7 +529,7 @@ public class ConsultService {
 | 
	
		
			
				|  |  |                 "AND a.patient= '" +patient+"' "+
 | 
	
		
			
				|  |  | //                "AND b.to_doctor='" +doctor+"' "+
 | 
	
		
			
				|  |  |                 "AND a.del='1' " +
 | 
	
		
			
				|  |  |                 "AND type = 23" +
 | 
	
		
			
				|  |  |                 "AND type = 23 " +
 | 
	
		
			
				|  |  |                 "AND a.status=0";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 |