|  | @ -25,12 +25,14 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.enterprise.EnterpriseService;
 | 
	
		
			
				|  |  | import jdk.management.resource.internal.TotalResourceContext;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import javax.persistence.criteria.CriteriaBuilder;
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -280,13 +282,14 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |     /*
 | 
	
		
			
				|  |  |      * 医生转交
 | 
	
		
			
				|  |  |      * */
 | 
	
		
			
				|  |  |     public BaseComplaintDO passTo(String id,String complaintId,String doctor,String operator){
 | 
	
		
			
				|  |  |     public BaseComplaintDO passTo(String id,String complaintId,String doctor,String operator,String reason){
 | 
	
		
			
				|  |  |         BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
 | 
	
		
			
				|  |  |         BaseComplaintOperateLogDO baseComplaintOperateLogDO = new BaseComplaintOperateLogDO();
 | 
	
		
			
				|  |  |         String doctorName="";
 | 
	
		
			
				|  |  |         String complaitTypeName="";
 | 
	
		
			
				|  |  |         if (null!=baseComplaintDO){
 | 
	
		
			
				|  |  |             baseComplaintOperateLogDO.setOperateFrom(operator);
 | 
	
		
			
				|  |  |             baseComplaintOperateLogDO.setReason(reason);
 | 
	
		
			
				|  |  |             baseComplaintOperateLogDO.setOperateTo(doctor);
 | 
	
		
			
				|  |  |             baseComplaintOperateLogDO.setComplaintTo(complaintId);
 | 
	
		
			
				|  |  |             baseComplaintOperateLogDO.setComplaintFrom(baseComplaintDO.getComplaintId());
 | 
	
	
		
			
				|  | @ -302,6 +305,7 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             baseComplaintDO.setAcceptor(doctor);*/
 | 
	
		
			
				|  |  |             baseComplaintDO.setComplaintId(complaintId);
 | 
	
		
			
				|  |  |             baseComplaintDO.setPassto(doctor);
 | 
	
		
			
				|  |  |             BaseComplaintDictDO baseComplaintDictDO = baseComplaintDictDao.findById(complaintId);
 | 
	
		
			
				|  |  |             if (baseComplaintDictDO!=null){
 | 
	
		
			
				|  |  |                 complaitTypeName=baseComplaintDictDO.getName();
 | 
	
	
		
			
				|  | @ -389,7 +393,7 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |         if ("admin".equalsIgnoreCase(role)){
 | 
	
		
			
				|  |  |             queryAll=true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String sql="select t.id as \"id\"," +
 | 
	
		
			
				|  |  |         String sql="select DISTINCT t.id as \"id\"," +
 | 
	
		
			
				|  |  |                 " t.complaint_id as \"complaintId\"," +
 | 
	
		
			
				|  |  |                 " t.complaint_name as \"complaintName\"," +
 | 
	
		
			
				|  |  |                 " t.complaint_content as \"complaintContent\"," +
 | 
	
	
		
			
				|  | @ -418,10 +422,14 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |                 " t.feed_img as \"feedImg\"," +
 | 
	
		
			
				|  |  |                 " t.acceptor as \"acceptor\"," +
 | 
	
		
			
				|  |  |                 " t.mobile as \"mobile\"," +
 | 
	
		
			
				|  |  |                 " t.passto as \"passto\"," +
 | 
	
		
			
				|  |  |                 " t.acceptor_name as \"acceptorName\"" +
 | 
	
		
			
				|  |  |                 "from base_complaint t  " +
 | 
	
		
			
				|  |  |                 " left join base_patient b on t.patient=b.id" +
 | 
	
		
			
				|  |  |                 " where t.is_del=1";
 | 
	
		
			
				|  |  |                 " 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)){
 | 
	
		
			
				|  |  |             sql+=" and  g.status='3' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!queryAll){
 | 
	
		
			
				|  |  |             BaseComplaintDoctorDO baseComplaintDoctorDO= baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
 | 
	
		
			
				|  |  |             /*List<BaseComplaintOperateLogDO> logList =baseComplaintOperateDao.findbyOperateFrom(doctor);
 | 
	
	
		
			
				|  | @ -443,13 +451,44 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(complaint)){
 | 
	
		
			
				|  |  |                 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+"'";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 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.isNoneBlank(status)){
 | 
	
		
			
				|  |  |                     sql+=" and t.status !='-1'";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
 | 
	
		
			
				|  |  |                 sql+=" and t.complaint_id='"+complaint+"'";
 | 
	
		
			
				|  |  |             }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)&&"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'";
 | 
	
		
			
				|  |  |             }else  if (StringUtils.isNoneBlank(status)&&"3".equalsIgnoreCase(status)){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -458,10 +497,11 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |                 //sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
 | 
	
		
			
				|  |  |                 sql+=" and t.complaint_id='"+complaintId+"'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(status)){
 | 
	
		
			
				|  |  |                 sql+=" and t.status ='"+status+"'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(status)){
 | 
	
		
			
				|  |  |             sql+=" and t.status ='"+status+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(patientName)){
 | 
	
		
			
				|  |  |             sql+=" and t.patient_name like '%"+patientName+"%'";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -624,33 +664,144 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |         Integer recieve=0;
 | 
	
		
			
				|  |  |         Integer deal=0;
 | 
	
		
			
				|  |  |         Integer cacel=0;
 | 
	
		
			
				|  |  |         Integer passto=0;
 | 
	
		
			
				|  |  |         Integer total=0;
 | 
	
		
			
				|  |  |         if (baseComplaintDoctorDO!=null){
 | 
	
		
			
				|  |  |             Boolean queryAll=false;
 | 
	
		
			
				|  |  |             if ("admin".equalsIgnoreCase(role)){
 | 
	
		
			
				|  |  |                 queryAll=true;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (!queryAll){
 | 
	
		
			
				|  |  |                 complaints=baseComplaintDao.getCountByStatusAndComplaintId("0",baseComplaintDoctorDO.getComplaintId());
 | 
	
		
			
				|  |  |                 recieve=baseComplaintDao.getCountByStatusAndComplaintId("1",baseComplaintDoctorDO.getComplaintId());
 | 
	
		
			
				|  |  |                 deal=baseComplaintDao.getCountByStatusAndComplaintId("2",baseComplaintDoctorDO.getComplaintId());
 | 
	
		
			
				|  |  |                 //cacel=baseComplaintDao.getCountByStatusAndComplaintId("-1",baseComplaintDoctorDO.getComplaintId());
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 complaints=baseComplaintDao.getCountByStatus("0");
 | 
	
		
			
				|  |  |                 recieve=baseComplaintDao.getCountByStatus("1");
 | 
	
		
			
				|  |  |                 deal=baseComplaintDao.getCountByStatus("2");
 | 
	
		
			
				|  |  |                 cacel=baseComplaintDao.getCountByStatus("-1");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |                 Boolean queryAll=false;
 | 
	
		
			
				|  |  |                 if ("admin".equalsIgnoreCase(role)){
 | 
	
		
			
				|  |  |                     queryAll=true;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (!queryAll){
 | 
	
		
			
				|  |  |                     if ("808080eb7a194099017a1943fa820004".equalsIgnoreCase(baseComplaintDoctorDO.getComplaintId())) {
 | 
	
		
			
				|  |  |                         complaints = getCountByStatus(doctor,"0",role);
 | 
	
		
			
				|  |  |                         recieve = getCountByStatus(doctor,"1",role);
 | 
	
		
			
				|  |  |                         deal = getCountByStatus(doctor,"2",role);
 | 
	
		
			
				|  |  |                         passto = getCountByPassto(doctor);
 | 
	
		
			
				|  |  |                         total = getCountByStatus(doctor,"",role);
 | 
	
		
			
				|  |  |                     }else{
 | 
	
		
			
				|  |  |                         complaints=getCountByStatus(doctor,"0",role);
 | 
	
		
			
				|  |  |                         recieve=getCountByStatus(doctor,"1",role);
 | 
	
		
			
				|  |  |                         deal=getCountByStatus(doctor,"2",role);
 | 
	
		
			
				|  |  |                         passto=getCountByPassto(doctor);
 | 
	
		
			
				|  |  |                         total=getCountByStatus(doctor,"",role);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     //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+cacel;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         Integer total = complaints+recieve+deal+cacel;
 | 
	
		
			
				|  |  |         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;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public Integer getCountByPassto(String doctor){
 | 
	
		
			
				|  |  |         String sql ="select count(1) as \"total\" from (select  DISTINCT t.id   from base_complaint t left join base_complaint_operate_log b" +
 | 
	
		
			
				|  |  |                 " on t.id=b.relation_code where t.is_del='1' and b.status='3'";
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(doctor)){
 | 
	
		
			
				|  |  |             sql+=" and b.operate_from='"+doctor+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql+=") m";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> listcount=hibenateUtils.createSQLQuery(sql);
 | 
	
		
			
				|  |  |         Integer count=0;
 | 
	
		
			
				|  |  |         if (listcount!=null&&listcount.size()>0){
 | 
	
		
			
				|  |  |             count=Integer.valueOf(listcount.get(0).get("total").toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return count;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public Integer getCountByStatus(String doctor,String status,String role){
 | 
	
		
			
				|  |  |         Boolean queryAll=false;
 | 
	
		
			
				|  |  |         if ("admin".equalsIgnoreCase(role)){
 | 
	
		
			
				|  |  |             queryAll=true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         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)){
 | 
	
		
			
				|  |  |             sql+="  and g.status='3' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!queryAll){
 | 
	
		
			
				|  |  |             BaseComplaintDoctorDO baseComplaintDoctorDO= baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
 | 
	
		
			
				|  |  |             /*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()+",";
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }*/
 | 
	
		
			
				|  |  |             String complaint="";
 | 
	
		
			
				|  |  |             if (baseComplaintDoctorDO!=null){
 | 
	
		
			
				|  |  |                 if (baseComplaintDoctorDO.getComplaintId().equalsIgnoreCase("808080eb7a194099017a1943fa820004")){
 | 
	
		
			
				|  |  |                     complaint=baseComplaintDoctorDO.getComplaintId();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(complaint)){
 | 
	
		
			
				|  |  |                 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+"'";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 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.isNoneBlank(status)){
 | 
	
		
			
				|  |  |                     sql+=" and t.status !='-1'";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //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+"'";
 | 
	
		
			
				|  |  |                 } 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'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //complaint=complaint+","+types;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         System.out.println("sql"+sql);
 | 
	
		
			
				|  |  |         Integer count = 0;
 | 
	
		
			
				|  |  |         sql+=")g";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sql);
 | 
	
		
			
				|  |  |         if(total!=null&&total.size()>0){
 | 
	
		
			
				|  |  |             //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
 | 
	
		
			
				|  |  |             count = Integer.valueOf(total.get(0).get("count").toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return count;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /*
 | 
	
		
			
				|  |  |      * 查询投诉数量*/
 | 
	
	
		
			
				|  | @ -663,7 +814,6 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |         recieve=baseComplaintDao.getCountByStatusByPatient("1",patient);
 | 
	
		
			
				|  |  |         deal=baseComplaintDao.getCountByStatusByPatient("2",patient);
 | 
	
		
			
				|  |  |         cacel=baseComplaintDao.getCountByStatusByPatient("-1",patient);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Integer total = complaints+recieve+deal+cacel;
 | 
	
		
			
				|  |  |         Map map=new HashMap();
 | 
	
		
			
				|  |  |         map.put("complaints",complaints);
 | 
	
	
		
			
				|  | @ -698,6 +848,7 @@ public class BaseComplaintService {
 | 
	
		
			
				|  |  |                 " p.name as \"complaintNameFrom\" ," +
 | 
	
		
			
				|  |  |                 " n.name as \"complaintNameto\", " +
 | 
	
		
			
				|  |  |                 " t.operate_from as \"operateFrom\" ," +
 | 
	
		
			
				|  |  |                 " t.reason as \"reason\" ," +
 | 
	
		
			
				|  |  |                 " t.operate_to as \"operateTo\" ," +
 | 
	
		
			
				|  |  |                 " t.cancel_by as \"cancelBy\", " +
 | 
	
		
			
				|  |  |                 " t.operate_type as \"operateType\", " +
 |