Procházet zdrojové kódy

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

wangzhinan před 6 roky
rodič
revize
ab6bb3ac2f

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildImmuneVaccin.java

@ -27,6 +27,7 @@ public class ChildImmuneVaccin extends IdEntity {
	private String ymbm;                    //疫苗编码
	private String jzzc;                    //接种针次
	private Date jzrq;						  //接种日期
	private int ymsx;						  //疫苗属性(1:一类,2:二类)
	private Integer isOut;					  //是否超过接种日期7天(0是 1不是)
	private Integer alert_tag;              //0待提醒,1已提醒
	private Date alert_time;                //提醒时间
@ -131,6 +132,14 @@ public class ChildImmuneVaccin extends IdEntity {
		this.jzrq = jzrq;
	}
	public int getYmsx() {
		return ymsx;
	}
	public void setYmsx(int ymsx) {
		this.ymsx = ymsx;
	}
	public Integer getIsOut() {
		return isOut;
	}

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

@ -381,8 +381,7 @@ public class CustomerSynergyManageController extends BaseController {
    @ApiOperation(value = "客服首页")
    public String customerIndex(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
        try{
            return write(200,"获取成功!");
            return write(200,"获取成功!","data",synergyManageService.customerIndex(userCode));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
@ -465,5 +464,16 @@ public class CustomerSynergyManageController extends BaseController {
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "adminIndex",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页")
    public String adminIndex(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
        try{
            return write(200,"获取成功!","data",synergyManageService.customerIndex(userCode));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
}

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

@ -22,6 +22,7 @@ public class ManageCustomerOnlineRecordDO extends IdEntity {
    private String jobNo;//客服工号
    private String seat;//席位
    private String phone;//客服电话
    private String totalOnlineTime;//在线总时长
    @Column(name = "code")
    public String getCode() {
@ -94,4 +95,13 @@ public class ManageCustomerOnlineRecordDO extends IdEntity {
    public void setPhone(String phone) {
        this.phone = phone;
    }
    @Column(name = "total_online_time")
    public String getTotalOnlineTime() {
        return totalOnlineTime;
    }
    public void setTotalOnlineTime(String totalOnlineTime) {
        this.totalOnlineTime = totalOnlineTime;
    }
}

+ 2 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/UserDao.java

@ -38,4 +38,6 @@ public interface UserDao extends PagingAndSortingRepository<User, Long>, JpaSpec
	User findByJobNo(String jobNo);
	List<User> findByType(int type);
}

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

@ -1,10 +1,16 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageCustomerOnlineRecordDO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
public interface ManageCustomerOnlineRecordDao extends PagingAndSortingRepository<ManageCustomerOnlineRecordDO, Long> {
    @Query("select r from ManageCustomerOnlineRecordDO r where r.customerCode=?1 and r.createTime>=?2 and r.createTime<=?3 order by r.createTime")
    List<ManageCustomerOnlineRecordDO> findByCustomerCodeToday(String userCode,String startTime,String endTime);
}

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

@ -70,6 +70,8 @@ public class SynergyManageService extends BaseJpaService {
    private TownDao townDao;
    @Autowired
    private FastDFSUtil fastDFSUtil;
    @Autowired
    private ManageCustomerOnlineRecordDao manageCustomerOnlineRecordDao;
    /**
     * 根据服务编码获取工单
@ -1217,18 +1219,59 @@ public class SynergyManageService extends BaseJpaService {
        return  jdbcTemplate.update(sql);
    }
    public void customerIndex(String userCode){
    public Map<String,Object> customerIndex(String userCode){
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String callSql ="SELECT * FROM manage_call_record WHERE user_code='"+userCode+"' and create_time>='"+today+" 00:00:00' and create_time<='"+today+" 23:59:59'";
        //今日外呼量
        //--------------今日外呼量-----------------//
        List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and type=2",new BeanPropertyRowMapper<>(CallRecord.class));
        int customerNoCount = 0;
        for(CallRecord callRecord : waihudList){
            //获取客户未接通数量
            if(callRecord.getAnswerStatus()==3){
                customerNoCount++;
            }
        }
        //求总时长
        int seconds = totalTaklTime(waihudList);
        //求平均时长
        map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
        map.put("waihuCount",waihudList.size());
        map.put("waihuCustomerNoCount",customerNoCount);
        //--------------今日在线时长-----------------//
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
        for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
        }
        //--------------今日接入量-----------------//
        List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and type=1",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int jieruTotalSecond = totalTaklTime(jieruList);
        //求平均时长
        map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        map.put("jieruCount",jieruList.size());
        //--------------今日协同任务外呼数-----------------//
        return map;
    }
    /**
     * 返回总的秒数
     * @param list
     * @return
     */
    public int totalTaklTime(List<CallRecord> list){
        int hours = 0;
        int minutes = 0;
        int seconds = 0;
        for(CallRecord callRecord : waihudList){
            //求总时长
        for(CallRecord callRecord : list){
            if (callRecord.getAnswerStatus()==1){
                String talkTime = callRecord.getTalkTime();
                String[] talkTimeStr = talkTime.split(":");
@ -1244,29 +1287,26 @@ public class SynergyManageService extends BaseJpaService {
                    }
                }
            }
            //获取客户未接通数量
            if(callRecord.getAnswerStatus()==3){
                customerNoCount++;
            }
        }
        String avgTalkTime = "";
        seconds = hours*3600+minutes*60+seconds;
        avgTalkTime =seconds/3600+"时";
        if (seconds%3600==0){
           avgTalkTime +="0分0秒";
        return seconds;
    }
    public String getAvgTime(int totalSeconds,int count){
        int avgSeconds = totalSeconds/count;
        String avgTalkTime = "";
        avgTalkTime =avgSeconds/3600+"时";
        if (avgSeconds%3600==0){
            avgTalkTime +="0分0秒";
        }else {
           if (seconds%3600%60==0){
               avgTalkTime +=seconds%3600/60+"分0秒";
           }else {
               avgTalkTime +=seconds%3600/60+"分"+seconds%3600%60+"秒";
           }
            if (avgSeconds%3600%60==0){
                avgTalkTime +=avgSeconds%3600/60+"分0秒";
            }else {
                avgTalkTime +=avgSeconds%3600/60+"分"+avgSeconds%3600%60+"秒";
            }
        }
        map.put("waihuCount",waihudList.size());
        map.put("waihuCustomerNoCount",customerNoCount);
        map.put("waihuAvgTalkTime",avgTalkTime);
        return avgTalkTime;
    }
    /**
     * 添加客户操作记录
     * @param workorderCode
@ -1303,4 +1343,49 @@ public class SynergyManageService extends BaseJpaService {
        byte[] bb =FastDFSUtil.download(groupName,remoteFileName);
    }
    public Map<String,Object> adminIndex(String userCode){
        List<User> userList = userDao.findByType(4);
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String callSql ="SELECT" +
                " r.*" +
                " FROM" +
                " manage_call_record r" +
                " LEFT JOIN wlyy_user u ON r.user_code = u.`code`" +
                " WHERE" +
                " u.type = 4" +
                " AND r.create_time >= '"+today+" 00:00:00'" +
                " AND r.create_time <= '"+today+" 23:59:59'";
        //--------------今日外呼量-----------------//
        List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and r.type=2",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int seconds = totalTaklTime(waihudList);
        //求平均时长
        map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
        map.put("waihuCount",waihudList.size());
        //--------------今日在线时长-----------------//
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
        for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
        }
        //--------------今日接入量-----------------//
        List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and r.type=1",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int jieruTotalSecond = totalTaklTime(jieruList);
        //求平均时长
        map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        map.put("jieruCount",jieruList.size());
        //--------------今日协同任务外呼数-----------------//
        return map;
    }
}

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java

@ -356,7 +356,7 @@ public class JMController {
			if (jsonObject.getInt("msgCode")==800){
				return Result.success("获取接种记录成功!",data);
			}else{
				return Result.error(jsonObject.getString("msg"));
				return Result.error(jsonObject.getString("body"));
			}
		} catch (Exception ex) {

+ 1 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java

@ -121,6 +121,7 @@ public class ChildVaccinImmuneService extends BaseService {
										childImmuneVaccin.setYmbm(ymbm);
										childImmuneVaccin.setJzzc(jzzc);
										childImmuneVaccin.setJzrq(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq"),DateUtil.YYYY_MM_DD));
										childImmuneVaccin.setYmsx(Integer.valueOf(vaccinJsonJSONArray.getJSONObject(j).getString("ymSx")));
										childImmuneVaccin.setAlert_tag(0);
										childImmuneVaccin.setDel(0);
										childImmuneVaccin.setCreate_time(new Date());

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -215,7 +215,7 @@ public class DoctorImmController extends BaseController {
				JSONObject json = new JSONObject(jsonObject.getString("data"));
				return write(200, "查询成功","data",json.getJSONArray("body"));
			}else {
				return error(-1,jsonObject.getString("error")+"--"+jsonObject.getString("message") );
				return error(-1,jsonObject.getString("msg") );
			}
		}catch (Exception e){
			error(e);