|  | @ -224,7 +224,7 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 去重医生
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public MixEnvelop findComplaintDoctorNew(String doctor, String doctorName, String deptName, String complaintType, Integer page, Integer pageSize) {
 | 
	
		
			
				|  |  |     public MixEnvelop findComplaintDoctorNew(String doctor, String doctorName,String role, String deptName, String complaintType, Integer page, Integer pageSize) {
 | 
	
		
			
				|  |  |         String sql = "select " +
 | 
	
		
			
				|  |  |                 " t.doctor as \"doctor\"," +
 | 
	
		
			
				|  |  |                 " t.doctor_name as \"doctorName\"," +
 | 
	
	
		
			
				|  | @ -439,7 +439,9 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |         return baseComplaintDO;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //查询投诉列表
 | 
	
		
			
				|  |  |     //passto 已转交
 | 
	
		
			
				|  |  |     public MixEnvelop findComplaintList(String role, String doctor, String status, String patientName, String patientId, String keyWord, String complaintId,
 | 
	
		
			
				|  |  |                                         String startTime, String endTime, Integer page, Integer pageSize, String pcAdmin) {
 | 
	
		
			
				|  |  |         MixEnvelop mixEnvelop = new MixEnvelop();
 | 
	
	
		
			
				|  | @ -491,75 +493,43 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |             sql += " and  g.status='3' ";
 | 
	
		
			
				|  |  |         }/*else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
 | 
	
		
			
				|  |  |             sql+=" and  g.status='1' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
 | 
	
		
			
				|  |  |             sql+=" and  g.status='2' ";
 | 
	
		
			
				|  |  |         }*/
 | 
	
		
			
				|  |  |         boolean flag = false;
 | 
	
		
			
				|  |  |         if (!queryAll) {
 | 
	
		
			
				|  |  |             //原本的
 | 
	
		
			
				|  |  | //            BaseComplaintDoctorDO baseComplaintDoctorDO = baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             boolean isOther = false;
 | 
	
		
			
				|  |  |             String complaint = "";
 | 
	
		
			
				|  |  |             String dbSql = " SELECT t.complaint_id from base_complaint_doctor t where t.is_del='1' and t.doctor='" + doctor + "'";
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(dbSql);
 | 
	
		
			
				|  |  |             if (!list.isEmpty()) {
 | 
	
		
			
				|  |  |                 for (Map<String, Object> map : list) {
 | 
	
		
			
				|  |  |                     if (String.valueOf(map.get("complaint_id")).equalsIgnoreCase("808080eb7a194099017a1943fa820004")) {
 | 
	
		
			
				|  |  |                         complaint = String.valueOf(map.get("complaint_id"));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |             String sql1 = "SELECT distinct di.id,di.`name` from base_complaint_doctor d,base_complaint_dict di " +
 | 
	
		
			
				|  |  |                     "WHERE di.id=d.complaint_id and d.is_del=1 and di.is_del=1 and d.doctor='"+doctor+"'";
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(sql1);
 | 
	
		
			
				|  |  |             if(list.size()==0){
 | 
	
		
			
				|  |  |                 mixEnvelop.setTotalCount(0);
 | 
	
		
			
				|  |  |                 mixEnvelop.setDetailModelList(new ArrayList());
 | 
	
		
			
				|  |  |                 mixEnvelop.setPageSize(pageSize);
 | 
	
		
			
				|  |  |                 mixEnvelop.setCurrPage(page);
 | 
	
		
			
				|  |  |                 return mixEnvelop;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             for (Map<String, Object> map:list){
 | 
	
		
			
				|  |  |                 String id = map.get("id")+"";
 | 
	
		
			
				|  |  |                 String name = map.get("name")+"";
 | 
	
		
			
				|  |  |                 if("其他".equals(name)){
 | 
	
		
			
				|  |  |                     isOther = true;
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     complaint += id+",";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             /*List<BaseComplaintOperateLogDO> logList =baseComplaintOperateDao.findbyOperateFrom(doctor);
 | 
	
		
			
				|  |  |             String types= "";
 | 
	
		
			
				|  |  |             if (logList!=null&&logList.size()>0){
 | 
	
		
			
				|  |  |                 for (int i=0;i<logList.size();i++){
 | 
	
		
			
				|  |  |                     if (i==logList.size()-1){
 | 
	
		
			
				|  |  |                         types+=logList.get(i).getComplaintTo();
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         types+=logList.get(i).getComplaintTo()+",";
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //            if (baseComplaintDoctorDO != null) {
 | 
	
		
			
				|  |  | //                if (baseComplaintDoctorDO.getComplaintId().equalsIgnoreCase("808080eb7a194099017a1943fa820004")) {
 | 
	
		
			
				|  |  | //                    complaint = baseComplaintDoctorDO.getComplaintId();
 | 
	
		
			
				|  |  | //                }
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(complaint)) {
 | 
	
		
			
				|  |  |                 if (!StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status !='-1'";
 | 
	
		
			
				|  |  |                     sql += " and (t.defaultdoctor ='defalutDoctor' or t.defaultdoctor='" + doctor + "')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and g.operate_from='" + doctor + "'";
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     sql += " and t.complaint_id='" + complaint + "'";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (!StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |                     sql += " or (g.operate_from='" + doctor + "'  and g.status='3')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and g.operate_from='" + doctor + "'";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status='0' and (t.passto='" + doctor + "' or t.passto is null )";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status='2' and t.operator='" + doctor + "' ";
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(complaint)){
 | 
	
		
			
				|  |  |                 complaint = complaint.substring(0,complaint.length()-1);
 | 
	
		
			
				|  |  |                 complaint = complaint.replaceAll(",","','");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (isOther) {
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status ='" + status + "'";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and g.operate_from='" + doctor + "'";
 | 
	
		
			
				|  |  |                     sql += " and g.operate_from='" + doctor;
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status='0' and t.passto='" + doctor + "'";
 | 
	
		
			
				|  |  |                     sql += " and t.status='0' and t.passto='" + doctor + "'"+ "' and t.complaint_id='"+complaint+"' ";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
 | 
	
	
		
			
				|  | @ -568,11 +538,9 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |                     sql += " and t.id IN (select col.relation_code from base_complaint_operate_log col where col.operate_to = '" + doctor + "'  )";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(complaintId)) {
 | 
	
		
			
				|  |  |                 //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
 | 
	
		
			
				|  |  |                 sql += " and t.complaint_id='" + complaintId + "'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(status)) {
 | 
	
	
		
			
				|  | @ -736,71 +704,85 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |     /*
 | 
	
		
			
				|  |  |      * 查询投诉数量*/
 | 
	
		
			
				|  |  |     public Map<String, Object> findComplaintCount(String doctor, String role, String pcAdmin) {
 | 
	
		
			
				|  |  | //        BaseComplaintDoctorDO baseComplaintDoctorDO = baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = " SELECT t.complaint_id from base_complaint_doctor t where t.is_del='1' and t.doctor='" + doctor + "'";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         Integer complaints = 0;
 | 
	
		
			
				|  |  |         Integer recieve = 0;
 | 
	
		
			
				|  |  |         Integer deal = 0;
 | 
	
		
			
				|  |  |         Integer cacel = 0;
 | 
	
		
			
				|  |  |         Integer passto = 0;
 | 
	
		
			
				|  |  |         Integer total = 0;
 | 
	
		
			
				|  |  |         boolean flag = false;
 | 
	
		
			
				|  |  |         System.out.println("数据==>" + JSON.toJSONString(list));
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             Boolean queryAll = false;
 | 
	
		
			
				|  |  |             if ("admin".equalsIgnoreCase(role)) {
 | 
	
		
			
				|  |  |                 queryAll = true;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             for (Map<String, Object> map : list) {
 | 
	
		
			
				|  |  |                 String complaint_id = String.valueOf(map.get("complaint_id"));
 | 
	
		
			
				|  |  |                 if ("808080eb7a194099017a1943fa820004".equalsIgnoreCase(complaint_id)) {
 | 
	
		
			
				|  |  |                     flag = true;
 | 
	
		
			
				|  |  |         Boolean queryAll = false;
 | 
	
		
			
				|  |  |         if ("admin".equalsIgnoreCase(role)) {
 | 
	
		
			
				|  |  |             queryAll = true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (!queryAll) {
 | 
	
		
			
				|  |  |             boolean isOther = false;
 | 
	
		
			
				|  |  |             String complaint = "";
 | 
	
		
			
				|  |  |             String sql1 = "SELECT distinct di.id,di.`name` from base_complaint_doctor d,base_complaint_dict di " +
 | 
	
		
			
				|  |  |                     "WHERE di.id=d.complaint_id and d.is_del=1 and di.is_del=1 and d.doctor='"+doctor+"'";
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = jdbcTemplate.queryForList(sql1);
 | 
	
		
			
				|  |  |             if(list.size()==0){
 | 
	
		
			
				|  |  |                 Map map = new HashMap();
 | 
	
		
			
				|  |  |                 map.put("complaints", complaints);
 | 
	
		
			
				|  |  |                 map.put("recieve", recieve);
 | 
	
		
			
				|  |  |                 map.put("deal", deal);
 | 
	
		
			
				|  |  |                 map.put("passto", passto);
 | 
	
		
			
				|  |  |                 map.put("cacel", cacel);
 | 
	
		
			
				|  |  |                 map.put("total", total);
 | 
	
		
			
				|  |  |                 return map;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             for (Map<String, Object> map:list){
 | 
	
		
			
				|  |  |                 String id = map.get("id")+"";
 | 
	
		
			
				|  |  |                 String name = map.get("name")+"";
 | 
	
		
			
				|  |  |                 if("其他".equals(name)){
 | 
	
		
			
				|  |  |                     isOther = true;
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     complaint += id+",";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (!queryAll) {
 | 
	
		
			
				|  |  | //                if ("808080eb7a194099017a1943fa820004".equalsIgnoreCase(baseComplaintDoctorDO.getComplaintId())) {
 | 
	
		
			
				|  |  |                 if (flag) {
 | 
	
		
			
				|  |  |                     complaints = getCountByStatus(doctor, "0", role);
 | 
	
		
			
				|  |  |                     recieve = getCountByStatus(doctor, "1", role);
 | 
	
		
			
				|  |  |                     deal = getCountByStatus(doctor, "2", role);
 | 
	
		
			
				|  |  |                     passto = getCountByPassto(doctor);
 | 
	
		
			
				|  |  |                     total = getCountByStatus(doctor, "", role);
 | 
	
		
			
				|  |  |                     //撤销
 | 
	
		
			
				|  |  |                     cacel = getCountByStatus(doctor, "-1", role);
 | 
	
		
			
				|  |  |                     if (StringUtils.isNotBlank(pcAdmin)) {
 | 
	
		
			
				|  |  |                         System.out.println("是pc管理员");
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         total = total - cacel;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(complaint)){
 | 
	
		
			
				|  |  |                 complaint = complaint.substring(0,complaint.length()-1);
 | 
	
		
			
				|  |  |                 complaint = complaint.replaceAll(",","','");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (isOther) {
 | 
	
		
			
				|  |  |                 complaints = getCountByStatus(doctor, "0",complaint, isOther);
 | 
	
		
			
				|  |  |                 recieve = getCountByStatus(doctor, "1",complaint, isOther);
 | 
	
		
			
				|  |  |                 deal = getCountByStatus(doctor, "2",complaint, isOther);
 | 
	
		
			
				|  |  |                 passto = getCountByPassto(doctor);
 | 
	
		
			
				|  |  |                 total = getCountByStatus(doctor, "",complaint, isOther);
 | 
	
		
			
				|  |  |                 //撤销
 | 
	
		
			
				|  |  |                 cacel = getCountByStatus(doctor, "-1",complaint, isOther);
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(pcAdmin)) {
 | 
	
		
			
				|  |  |                     System.out.println("是pc管理员");
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     complaints = getCountByStatus(doctor, "0", role);
 | 
	
		
			
				|  |  |                     recieve = getCountByStatus(doctor, "1", role);
 | 
	
		
			
				|  |  |                     deal = getCountByStatus(doctor, "2", role);
 | 
	
		
			
				|  |  |                     passto = getCountByPassto(doctor);
 | 
	
		
			
				|  |  |                     total = getCountByStatus(doctor, "", role);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     //撤销
 | 
	
		
			
				|  |  |                     cacel = getCountByStatus(doctor, "-1", role);
 | 
	
		
			
				|  |  |                     if (StringUtils.isNotBlank(pcAdmin)) {
 | 
	
		
			
				|  |  |                         System.out.println("是pc管理员");
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         total = total - cacel;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     total = total - cacel;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //cacel=baseComplaintDao.getCountByStatusAndComplaintId("-1",baseComplaintDoctorDO.getComplaintId());
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 complaints = baseComplaintDao.getCountByStatus("0");
 | 
	
		
			
				|  |  |                 recieve = baseComplaintDao.getCountByStatus("1");
 | 
	
		
			
				|  |  |                 deal = baseComplaintDao.getCountByStatus("2");
 | 
	
		
			
				|  |  |                 cacel = baseComplaintDao.getCountByStatus("-1");
 | 
	
		
			
				|  |  |                 total = complaints + recieve + deal;
 | 
	
		
			
				|  |  |                 complaints = getCountByStatus(doctor, "0",complaint, isOther);
 | 
	
		
			
				|  |  |                 recieve = getCountByStatus(doctor, "1",complaint, isOther);
 | 
	
		
			
				|  |  |                 deal = getCountByStatus(doctor, "2",complaint, isOther);
 | 
	
		
			
				|  |  |                 passto = getCountByPassto(doctor);
 | 
	
		
			
				|  |  |                 total = getCountByStatus(doctor, "",complaint, isOther);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //撤销
 | 
	
		
			
				|  |  |                 cacel = getCountByStatus(doctor, "-1",complaint, isOther);
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(pcAdmin)) {
 | 
	
		
			
				|  |  |                     //是管理员加上撤销的
 | 
	
		
			
				|  |  |                     total = +cacel;
 | 
	
		
			
				|  |  |                     System.out.println("是pc管理员");
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     total = total - cacel;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //cacel=baseComplaintDao.getCountByStatusAndComplaintId("-1",baseComplaintDoctorDO.getComplaintId());
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             complaints = baseComplaintDao.getCountByStatus("0");
 | 
	
		
			
				|  |  |             recieve = baseComplaintDao.getCountByStatus("1");
 | 
	
		
			
				|  |  |             deal = baseComplaintDao.getCountByStatus("2");
 | 
	
		
			
				|  |  |             cacel = baseComplaintDao.getCountByStatus("-1");
 | 
	
		
			
				|  |  |             total = complaints + recieve + deal;
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(pcAdmin)) {
 | 
	
		
			
				|  |  |                 //是管理员加上撤销的
 | 
	
		
			
				|  |  |                 total = +cacel;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         Map map = new HashMap();
 | 
	
	
		
			
				|  | @ -828,85 +810,36 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |         return count;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Integer getCountByStatus(String doctor, String status, String role) {
 | 
	
		
			
				|  |  |         Boolean queryAll = false;
 | 
	
		
			
				|  |  |         if ("admin".equalsIgnoreCase(role)) {
 | 
	
		
			
				|  |  |             queryAll = true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     public Integer getCountByStatus(String doctor, String status,String complaint, boolean isOther) {
 | 
	
		
			
				|  |  |         String sql = "select count(1)  as \"count\" from (select DISTINCT t.id  " +
 | 
	
		
			
				|  |  |                 "  from base_complaint t  " +
 | 
	
		
			
				|  |  |                 " left join base_patient b on t.patient=b.id ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql += " left join base_complaint_operate_log g on t.id=g.relation_code where t.is_del='1' ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |         if ("3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |             sql += "  and g.status='3' ";
 | 
	
		
			
				|  |  |         } /*else if (StringUtils.isNoneBlank(status)&&"1".equalsIgnoreCase(status)){
 | 
	
		
			
				|  |  |             sql+=" and  g.status='1' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         else if (StringUtils.isNoneBlank(status)&&"2".equalsIgnoreCase(status)){
 | 
	
		
			
				|  |  |             sql+=" and  g.status='2' ";
 | 
	
		
			
				|  |  |         }*/
 | 
	
		
			
				|  |  |         if (!queryAll) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //原本的
 | 
	
		
			
				|  |  | //            BaseComplaintDoctorDO baseComplaintDoctorDO = baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = getComplaintList(doctor);
 | 
	
		
			
				|  |  |             String complaint = "";
 | 
	
		
			
				|  |  |             if (!list.isEmpty()) {
 | 
	
		
			
				|  |  |                 for (Map<String, Object> map : list) {
 | 
	
		
			
				|  |  |                     String complaint_id = String.valueOf(map.get("complaint_id"));
 | 
	
		
			
				|  |  |                     if (complaint_id.equalsIgnoreCase("808080eb7a194099017a1943fa820004")) {
 | 
	
		
			
				|  |  |                         complaint = complaint_id;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |         if (isOther) {
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |                 sql += " and t.status ='" + status + "'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(complaint)) {
 | 
	
		
			
				|  |  |                 if (!StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status !='-1'";
 | 
	
		
			
				|  |  |                     sql += " and (t.defaultdoctor ='defalutDoctor' or t.defaultdoctor='" + doctor + "')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and g.operate_from='" + doctor + "'";
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     sql += " and t.complaint_id='" + complaint + "'";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (!StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |                     sql += " or (g.operate_from='" + doctor + "'  and g.status='3')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and g.operate_from='" + doctor + "'";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status='0' and (t.passto='" + doctor + "' or t.passto is null )";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status='2' and t.operator='" + doctor + "' ";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                 sql += " and g.operate_from='" + doctor + "'";
 | 
	
		
			
				|  |  |             } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                 sql += " and t.status='0' and t.passto='" + doctor + "'"+ "' and t.complaint_id='"+complaint+"' ";
 | 
	
		
			
				|  |  |             } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                 sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
 | 
	
		
			
				|  |  |             } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                 sql += " and t.status='2' and t.operator='" + doctor + "' ";
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(status) && "3".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and g.operate_from='" + doctor + "'";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "0".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status='0' and t.passto='" + doctor + "'";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "1".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += "  and t.status='1' and t.acceptor='" + doctor + "' ";
 | 
	
		
			
				|  |  |                 } else if (StringUtils.isNoneBlank(status) && "2".equalsIgnoreCase(status)) {
 | 
	
		
			
				|  |  |                     sql += " and t.status='2' and t.operator='" + doctor + "' ";
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     sql += " and t.id IN (select col.relation_code from base_complaint_operate_log col where col.operate_to = '" + doctor + "'  )";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (!StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |                 sql += " and t.status !='-1'";
 | 
	
		
			
				|  |  |                 sql += " and t.id IN (select col.relation_code from base_complaint_operate_log col where col.operate_to = '" + doctor + "'  )";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isNoneBlank(status)) {
 | 
	
		
			
				|  |  |             sql += " and t.status !='-1'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //complaint=complaint+","+types;
 | 
	
		
			
				|  |  |         System.out.println("sql" + sql);
 | 
	
		
			
				|  |  |         Integer count = 0;
 | 
	
		
			
				|  |  |         sql += ")g";
 |