|
@ -39,23 +39,60 @@ public class SynergyManageService {
|
|
|
public ManageSynergyWorkorderDO findWorkOrderByCode(String workorderCode) {
|
|
|
return workOrderDao.findByCode(workorderCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 我接收到的任务
|
|
|
* @param code
|
|
|
* @param keywords
|
|
|
* @param workorderType
|
|
|
* @param isMyTask
|
|
|
* @param isMyTask 是否由我负责
|
|
|
* @param status
|
|
|
* @param priority
|
|
|
* @param timeout
|
|
|
* @param workorderCode
|
|
|
* @param principal
|
|
|
* @param serviceStartTime
|
|
|
* @param serviceEndTime
|
|
|
* @param patientName
|
|
|
* @param ssc 社保卡号
|
|
|
* @param idcard 身份证
|
|
|
* @param userType 1、医生,2、客服,3、客服管理员
|
|
|
* @param isAcceptTask 1、我接收到的任务,2、我派发的任务,3、待接收(客服管理员),4、已接收(客服管理员)
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void acceptTaskList(String code,String keywords,Integer workorderType,
|
|
|
public List<Map<String,Object>> workorderList(String code,String keywords,Integer workorderType,
|
|
|
Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
|
|
|
String principal,String serviceStartTime,String serviceEndTime,
|
|
|
String patientName,String ssc,String idcard) throws Exception{
|
|
|
String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask) throws Exception{
|
|
|
|
|
|
String servicerTable = "";
|
|
|
String whereSql = "";
|
|
|
if(userType==3){//客服管理员
|
|
|
whereSql +=" and w.create_user_type=1 ";//创建人为医生
|
|
|
if(isAcceptTask==3){//待接收
|
|
|
whereSql +=" and w.status =1 ";
|
|
|
}else if(isAcceptTask==4){//已接收
|
|
|
whereSql +=" and w.status in (2,3) ";
|
|
|
}
|
|
|
}else if(userType==2){//客服
|
|
|
if(isAcceptTask==1){//我接收
|
|
|
whereSql +=" and w.create_user_type=1 ";//创建人为医生
|
|
|
whereSql += " and e.executor_code ="+code+" ";
|
|
|
}else if(isAcceptTask==2){//我派发
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
|
whereSql += " and e.create_user ="+code+" ";
|
|
|
}
|
|
|
}else if(userType==3){//医生
|
|
|
if(isAcceptTask==1){//我接收
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
|
whereSql += " and e.executor_code ="+code+" ";
|
|
|
}else if(isAcceptTask==2){//我派发
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为医生
|
|
|
whereSql += " and e.create_user ="+code+" ";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//关键字查询
|
|
|
if(StringUtils.isNotEmpty(keywords)){
|
|
|
servicerTable +=" left join wlyy.manage_synergy_workorder_servicer s on s.workorder_code=w.code ";
|
|
@ -69,7 +106,7 @@ public class SynergyManageService {
|
|
|
}
|
|
|
//是否是我负责的
|
|
|
if(isMyTask!=null){
|
|
|
whereSql += " and e.executor_code ="+code+" ";
|
|
|
whereSql += " and e.executor_code ="+code+" and e.executor_type=1 ";
|
|
|
}
|
|
|
//工单状态
|
|
|
if(status!=null){
|
|
@ -81,7 +118,7 @@ public class SynergyManageService {
|
|
|
}
|
|
|
//是否超时
|
|
|
if(timeout!=null){
|
|
|
|
|
|
whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
|
|
|
}
|
|
|
//服务编码
|
|
|
if(StringUtils.isNotEmpty(workorderCode)){
|
|
@ -113,7 +150,7 @@ public class SynergyManageService {
|
|
|
String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w " +servicerTable+
|
|
|
" left join wlyy.vmanage_synergy_workorder_executor e on e.workorder_code=w.code " +
|
|
|
" where w.status in (2,3) and w.del=1 " +
|
|
|
" and e.del=1 "+whereSql;
|
|
|
" and e.del=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
|
|
|
List<Map<String,Object>> resultWorkorderList = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
for(Map<String,Object> one : resultWorkorderList){
|
|
@ -134,6 +171,8 @@ public class SynergyManageService {
|
|
|
map.put("serviceTime", DateUtil.dateToStr((Date)one.get("service_time"),"yyyy-MM-dd HH:mm"));//服务时间
|
|
|
map.put("priority",one.get("priority"));//工单优先级
|
|
|
map.put("priorityName",((Integer)one.get("priority"))==1?"加急":"普通");
|
|
|
Integer overTime = isServiceOverTime((Date)one.get("service_time"));
|
|
|
map.put("overTime",overTime);//是否超时
|
|
|
String[] servicer = (one.get("servicer_key")+"").split(",");
|
|
|
map.put("servicer",servicer[0]);//服务对象
|
|
|
map.put("servicerCount",one.get("servicer_count"));//服务对象人数
|
|
@ -151,7 +190,11 @@ public class SynergyManageService {
|
|
|
List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(one.get("code")+"",1);
|
|
|
String managerName = managerList.size()>0?managerList.get(0).getExecutorName():"";
|
|
|
map.put("managerName",managerName);//负责人的名称
|
|
|
Integer finishedServicerCount = workorderServicerDao.findByWorkorderCodeCount(one.get("code")+"",3);
|
|
|
map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -177,10 +220,23 @@ public class SynergyManageService {
|
|
|
//服务时间+4小时 > 当前时间 > 服务时间(红色超时)2
|
|
|
//服务时间 HH:mm:59()> 当前时间 > 服务时间 HH:mm:00(黄色超时)1
|
|
|
//服务时间 HH:mm:00 > 当前时间 (正常)0
|
|
|
Long serviceTimeAfter4Long = serviceTime.getTime()+4*60*60*1000;
|
|
|
Long serviceTimeLong = serviceTime.getTime();
|
|
|
Integer serviceStatus = null;
|
|
|
String serviceTimeStart = DateUtil.dateToStr(serviceTime,"yyyy-MM-dd HH:mm")+":00";
|
|
|
String serviceTimeEnd = DateUtil.dateToStr(serviceTime,"yyyy-MM-dd HH:mm")+":59";
|
|
|
Long serviceTimeStartLong = DateUtil.strToDate(serviceTimeStart,"yyyy-MM-dd HH:mm:ss").getTime();
|
|
|
Long serviceTimeEndLong = DateUtil.strToDate(serviceTimeEnd,"yyyy-MM-dd HH:mm:ss").getTime();
|
|
|
Long serviceTimeAfter4Long = serviceTimeEndLong+4*60*60*1000;
|
|
|
Long currentTime = new Date().getTime();
|
|
|
return 0;
|
|
|
if(currentTime<serviceTimeStartLong){//正常
|
|
|
serviceStatus=0;
|
|
|
}else if(currentTime>=serviceTimeStartLong&¤tTime<=serviceTimeEndLong){//黄色超时
|
|
|
serviceStatus=1;
|
|
|
}else if(currentTime>serviceTimeEndLong&¤tTime<=serviceTimeAfter4Long){//红色超时
|
|
|
serviceStatus=2;
|
|
|
}else if(currentTime>serviceTimeAfter4Long){//已超时
|
|
|
serviceStatus=3;
|
|
|
}
|
|
|
return serviceStatus;
|
|
|
}
|
|
|
|
|
|
//获取系统服务详情
|
|
@ -232,6 +288,8 @@ public class SynergyManageService {
|
|
|
map.put("remark", workorderDO.getDealResultRemark());
|
|
|
map.put("accessory", workorderDO.getDealResultAccessory());
|
|
|
}
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
}
|