Jelajahi Sumber

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

# Conflicts:
#	patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java
humingfen 7 tahun lalu
induk
melakukan
c14f1795e5

+ 56 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java

@ -4,11 +4,16 @@ import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
@ -32,4 +37,55 @@ public class CustomerSynergyManageController extends BaseController {
        }
    }
    @RequestMapping(value = "workorderList", method = RequestMethod.GET)
    @ApiOperation("客服系统-协同服务列表")
    public String workorderList(@ApiParam(name = "userCode", value = "客服code", required = false)
                                @RequestParam(value = "userCode", required = false)String userCode,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
                                @RequestParam(value = "keywords", required = false)String keywords,
                                @ApiParam(name = "workorderType", value = "服务类型(0、咨询,1、健康教育,2、预约,3、随访,4、问卷调查,5、疾病筛查)", required = false)
                                @RequestParam(value = "workorderType", required = false)Integer workorderType,
                                @ApiParam(name = "isMyTask", value = "是否由我负责,1、我负责,null全部", required = false)
                                @RequestParam(value = "isMyTask", required = false)Integer isMyTask,
                                @ApiParam(name = "status", value = "工单状态(0、草稿,1、未接受,2、处理中,3、处理完成,4、退回)", required = false)
                                @RequestParam(value = "status", required = false)Integer status,
                                @ApiParam(name = "priority", value = "工单优先级(0、普通,1、加急)", required = false)
                                @RequestParam(value = "priority", required = false)Integer priority,
                                @ApiParam(name = "timeout", value = "是否超时1、超时,null全部", required = false)
                                @RequestParam(value = "timeout", required = false)Integer timeout,
                                @ApiParam(name = "workorderCode", value = "服务编号", required = false)
                                @RequestParam(value = "workorderCode", required = false)String workorderCode,
                                @ApiParam(name = "principal", value = "负责人", required = false)
                                @RequestParam(value = "principal", required = false)String principal,
                                @ApiParam(name = "serviceStartTime", value = "服务开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                @RequestParam(value = "serviceStartTime", required = false)String serviceStartTime,
                                @ApiParam(name = "serviceEndTime", value = "服务结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                @RequestParam(value = "serviceEndTime", required = false)String serviceEndTime,
                                @ApiParam(name = "patientName", value = "服务对象名称", required = false)
                                @RequestParam(value = "patientName", required = false)String patientName,
                                @ApiParam(name = "ssc", value = "社保卡号", required = false)
                                @RequestParam(value = "ssc", required = false)String ssc,
                                @ApiParam(name = "idcard", value = "身份证号", required = false)
                                @RequestParam(value = "idcard", required = false)String idcard,
                                @ApiParam(name = "userType", value = "2、客服,3、客服管理员", required = true)
                                @RequestParam(value = "userType", required = true)Integer userType,
                                @ApiParam(name = "isAcceptTask", value = "1、我接收到的任务,2、我派发的任务,3、待接收(客服管理员),4、已接收(客服管理员)", required = true)
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = true)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = true)
                                @RequestParam(value = "pageSize", required = false,defaultValue = "10")Integer pageSize){
        try {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            List<Map<String,Object>> result = synergyManageService.workorderList(userCode,keywords,workorderType,isMyTask,status,priority,timeout,workorderCode,
                    principal,serviceStartTime,serviceEndTime,patientName,ssc,idcard,userType,isAcceptTask);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 96 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderCustomerLog.java

@ -0,0 +1,96 @@
package com.yihu.wlyy.entity.synergy;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by 刘文彬 on 2018/9/29.
 * 客服操作工单日志
 */
@Entity
@Table(name = "manage_synergy_workorder_customer_log")
public class ManageSynergyWorkorderCustomerLog extends IdEntity {
    private String code;
    private Date createTime;//添加时间
    private String workorderCode;//系统服务工单code
    private String servicePatientCode;//协同服务对象code
    private String createUserCode;//创建人(客服)code
    private String createUserName;//创建人(客服)名称
    private String callCode;//通话记录code
    private Integer status;//状态(0、未完成,1、处理完成)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "workorder_code")
    public String getWorkorderCode() {
        return workorderCode;
    }
    public void setWorkorderCode(String workorderCode) {
        this.workorderCode = workorderCode;
    }
    @Column(name = "service_patient_code")
    public String getServicePatientCode() {
        return servicePatientCode;
    }
    public void setServicePatientCode(String servicePatientCode) {
        this.servicePatientCode = servicePatientCode;
    }
    @Column(name = "create_user_code")
    public String getCreateUserCode() {
        return createUserCode;
    }
    public void setCreateUserCode(String createUserCode) {
        this.createUserCode = createUserCode;
    }
    @Column(name = "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Column(name = "call_code")
    public String getCallCode() {
        return callCode;
    }
    public void setCallCode(String callCode) {
        this.callCode = callCode;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java

@ -8,6 +8,9 @@ import org.springframework.transaction.annotation.Transactional;
public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepository<ManageSynergyWorkorderServicerDO, Long> {
    @Query(" select count(1) from ManageSynergyWorkorderServicerDO s where s.workorderCode=?1 and s.status=?2 ")
    Integer findByWorkorderCodeCount(String workorderCode,Integer status);
    @Transactional
    @Modifying
    @Query("update ManageSynergyWorkorderServicerDO s set s.relationCode = ?2 where s.code = ?1")

+ 67 - 9
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -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&&currentTime<=serviceTimeEndLong){//黄色超时
            serviceStatus=1;
        }else if(currentTime>serviceTimeEndLong&&currentTime<=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;
    }
}