|  | @ -0,0 +1,110 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.service.call;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.call.CallRecord;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.call.CallService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.message.Message;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.Patient;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.service.SignFamilyService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.call.CallRecordDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.call.CallServiceDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.message.MessageDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.patient.PatientDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.BaseService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.HttpClientUtil;
 | 
	
		
			
				|  |  | import org.apache.commons.collections.map.HashedMap;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.apache.http.NameValuePair;
 | 
	
		
			
				|  |  | import org.apache.http.message.BasicNameValuePair;
 | 
	
		
			
				|  |  | import org.json.JSONObject;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | @Service
 | 
	
		
			
				|  |  | public class CustomerService extends BaseService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private CallRecordDao callRecordDao;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private CallServiceDao callServiceDao;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private PatientDao patientDao;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private SignFamilyService familyService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private JdbcTemplate jdbcTemplate;
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private MessageDao messageDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	public List<Map<String,Object>> getCallServices(String keyword, Integer serverType,Integer state,String patientName,String ssc,String idCard,String doctorName,String code,Integer adminTeamCode ,String startDate,String endDate,Integer page,Integer size){
 | 
	
		
			
				|  |  | 		String sql = "SELECT " +
 | 
	
		
			
				|  |  | 				" s.`code`, " +
 | 
	
		
			
				|  |  | 				" s.patient, " +
 | 
	
		
			
				|  |  | 				" s.patient_name AS patientName, " +
 | 
	
		
			
				|  |  | 				" s.doctor, " +
 | 
	
		
			
				|  |  | 				" s.doctor_name AS doctorName, " +
 | 
	
		
			
				|  |  | 				" s.server_type As serverType, " +
 | 
	
		
			
				|  |  | 				" s.state, " +
 | 
	
		
			
				|  |  | 				" s.server_content AS serverContent, " +
 | 
	
		
			
				|  |  | 				" s.create_time AS createTime, " +
 | 
	
		
			
				|  |  | 				" s.user, " +
 | 
	
		
			
				|  |  | 				" s.user_name AS userName " +
 | 
	
		
			
				|  |  | 				" FROM " +
 | 
	
		
			
				|  |  | 				" manage_call_service s " +
 | 
	
		
			
				|  |  | 				" WHERE " +
 | 
	
		
			
				|  |  | 				" 1 = 1";
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(keyword)){
 | 
	
		
			
				|  |  | 			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(serverType!=null){
 | 
	
		
			
				|  |  | 			sql += " AND s.server_type ='"+serverType+"' " ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(state != null){
 | 
	
		
			
				|  |  | 			sql +=" AND s.state ='"+state+"'";
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(patientName)){
 | 
	
		
			
				|  |  | 			sql +=" AND s.patient_name ='"+patientName+"'" ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(ssc)){
 | 
	
		
			
				|  |  | 			sql +=" AND s.ssc ='"+ssc+"'" ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(idCard)){
 | 
	
		
			
				|  |  | 			sql +=" AND s.IdCard ='"+idCard+"'" ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(doctorName)){
 | 
	
		
			
				|  |  | 			sql +=" AND s.doctor_name ='"+doctorName+"'" ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(code)){
 | 
	
		
			
				|  |  | 			sql +=" AND s.code ='"+code+"'" ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(startDate)){
 | 
	
		
			
				|  |  | 			sql +=" AND s.create_time >='"+startDate+" 00:00:00'" ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(StringUtils.isNotBlank(endDate)){
 | 
	
		
			
				|  |  | 			sql +=" AND s.create_time <='"+endDate+" 23:59:59'" ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if(adminTeamCode!=null){
 | 
	
		
			
				|  |  | 			sql +=" AND s.admin_team_code ="+adminTeamCode ;
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		sql += " LIMIT "+(page-1)*size+","+size +" ORDER BY r.create_time DESC";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 		return list;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	public List<Message> getCallServiceMes(String doctor){
 | 
	
		
			
				|  |  | 		List<Message> mes =  messageDao.findByReceiverCallService(doctor);
 | 
	
		
			
				|  |  | 		return mes;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |