Ver código fonte

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/service/synergy/SynergyManageService.java
liuwenbin 6 anos atrás
pai
commit
6e18c99468

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

@ -2,6 +2,7 @@ package com.yihu.wlyy.controller.synergy.customer;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.synergy.QuestionnaireManageService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -22,6 +23,8 @@ public class CustomerQuestionnaireController extends BaseController {
    @Autowired
    private QuestionnaireManageService questionnaireService;
    @Autowired
    private SynergyManageService synergyManageService;
    @RequestMapping(value = "saveAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户答案")
@ -31,9 +34,8 @@ public class CustomerQuestionnaireController extends BaseController {
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")Integer labelType,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估", defaultValue = "1")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source,
                              @ApiParam(value = "协同工单服务对象表code")@RequestParam(value = "source")String serviceCode) {
                              @ApiParam(value = "协同工单服务对象表code")@RequestParam(value = "serviceCode")String serviceCode) {
        try {
            return  write(200, "保存成功!", "data", questionnaireService.saveResultAndAnswer(patientCode, labelType, customerCode, isAgain, source,jsonData, serviceCode));
        } catch (Exception e) {
            e.printStackTrace();
@ -73,4 +75,30 @@ public class CustomerQuestionnaireController extends BaseController {
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "isNotException", method = RequestMethod.POST)
    @ApiOperation(value = "判断是否异常通话")
    public String isNotException(@ApiParam(value = "协同服务工单code") @RequestParam String workorderCode,
                                 @ApiParam(value = "客服code") @RequestParam String customerCode) {
        try {
            //判断是否有异常中断
            Integer count = synergyManageService.findExceptionCount(workorderCode, customerCode);
            return write(200, "查询成功!", "data", count);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "loadingInfo", method = RequestMethod.POST)
    @ApiOperation(value = "载入未完成信息")
    public String loadingInfo(@ApiParam(value = "协同服务工单code") @RequestParam String workorderCode,
                                 @ApiParam(value = "客服code") @RequestParam String customerCode) {
        try {
            return write(200, "查询成功!", "data", synergyManageService.loadingInfo(workorderCode, customerCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

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

@ -11,4 +11,7 @@ public interface ManageSynergyWorkorderCustomerLogDao extends PagingAndSortingRe
    @Query("select count(distinct l.callCode) from ManageSynergyWorkorderCustomerLogDO l where l.servicePatientCode=?1 ")
    Integer callNumByWorkorder(String servicePatientCode);
    @Query("select count(1) from ManageSynergyWorkorderCustomerLogDO cl where cl.workorderCode = ?1 and cl.createUserCode = ?2 and cl.status = 0")
    Integer findExceptionCount(String workorderCode, String customerCode);
}

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

@ -52,6 +52,8 @@ public class SynergyManageService extends BaseJpaService {
    @Autowired
    private SignPatientLabelInfoDao signPatientLabelInfoDao;
    @Autowired
    private ManageSynergyWorkorderCustomerLogDao customerLogDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private ManageSynergyWorkorderReminderDao manageSynergyWorkorderReminderDao;
@ -388,8 +390,8 @@ public class SynergyManageService extends BaseJpaService {
            Map<String,Object> workorderMap = resultWorkorderList.get(0);
            //居民信息
            resultMap.put("mobile",workorderMap.get("mobile"));//电话号码
            resultMap.put("mobile",workorderMap.get("mobile"));//居民姓名
            Integer callNum = manageSynergyWorkorderCustomerLogDao.callNumByWorkorder(workorderMap.get("servicerCode")+"");
            resultMap.put("patientName",workorderMap.get("service_patient_name"));//居民姓名
            Integer callNum = customerLogDao.callNumByWorkorder(workorderMap.get("servicerCode")+"");
            resultMap.put("callNum",callNum);//已呼叫次数
            Patient patient =patientDao.findByCode(workorderMap.get("service_patient_code")+"");
            Integer sex = patient.getSex();
@ -488,14 +490,27 @@ public class SynergyManageService extends BaseJpaService {
        workOrderDao.save(workorderDO);
    }
    /**
     * 发送消息
     * @param workorderDO
     * @param user
     * @param type
     */
    public void sendMessage(ManageSynergyWorkorderDO workorderDO, User user, Integer type){
        String url = wlyyUrl + "doctor/message/sendMessage";
        //组装message内容
        JSONObject message = new JSONObject();
        message.put("sender", workorderDO.getReceiverCode());
        message.put("receiver", workorderDO.getCreateUser());
        message.put("type", type);
        message.put("relationCode", workorderDO.getCode());
        if(type == 24){
            message.put("receiver", workorderDO.getReceiverCode());
            message.put("sender", workorderDO.getCreateUser());
            message.put("type", type);
            message.put("relationCode", workorderDO.getCode());
        }else {
            message.put("sender", workorderDO.getReceiverCode());
            message.put("receiver", workorderDO.getCreateUser());
            message.put("type", type);
            message.put("relationCode", workorderDO.getCode());
        }
        //组装jsonObject内容
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", workorderDO.getType());
@ -515,6 +530,68 @@ public class SynergyManageService extends BaseJpaService {
        }
    }
    /**
     * 查找该客服该工单是否有异常工单
     * @param workorderCode
     * @param customerCode
     * @return
     */
    public Integer findExceptionCount(String workorderCode, String customerCode) {
        return customerLogDao.findExceptionCount(workorderCode, customerCode);
    }
    public Map<String, Object> loadingInfo(String workorderCode, String customerCode) {
        Map<String,Object> resultMap = new HashMap<>();
        String sql = "SELECT s.service_patient_name, s.service_patient_code, s.`code`, s.s.hospital_name,s.town_name " +
                "from (SELECT DISTINCT r.patient,cl.workorder_code from manage_synergy_workorder_customer_log cl " +
                "LEFT JOIN manage_call_record r on cl.call_code = r.`code` " +
                "where cl.workorder_code = " + workorderCode + " and cl.create_user_code = " + customerCode + " and cl.`status` = 0 ORDER BY cl.create_time LIMIT 0,1) p " +
                "LEFT JOIN manage_synergy_workorder_servicer s on p.workorder_code = s.workorder_code and s.service_patient_code = p.patient and s.`status`=1";
        Map<String, Object> result = (Map<String, Object>) jdbcTemplate.queryForList(sql);
        String patientCode = (String) result.get("service_patient_name");
        resultMap.put("patientName", patientCode);
        resultMap.put("townName", result.get("town_name"));//所属区县
        resultMap.put("hospitalName", result.get("hospital_name"));//所属社区
        Integer callNum = customerLogDao.callNumByWorkorder((String) result.get("code"));
        resultMap.put("callNum",callNum);//已呼叫次数
        Patient patient = patientDao.findByCode(patientCode);
        Integer sex = patient.getSex();
        String sexName = "";
        if(sex==1){
            sexName="男";
        }else if(sex==2){
            sexName="女";
        }else{
            sexName="未知";
        }
        resultMap.put("sex",sexName);//性别
        Integer age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
        resultMap.put("age",age);//年龄
        SignFamily signFamily = signFamilyDao.findSignByPatient(patientCode);
        resultMap.put("signDoctor", signFamily.getDoctor());//签约医生(即:工单创建医生)
        resultMap.put("healthDoctor", signFamily.getDoctorHealthName());//健管师
        List<SignPatientLabelInfo> labelDiseaseType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(patientCode,  "3", 1);
        String diseaseType="";
        for(SignPatientLabelInfo one:labelDiseaseType){
            diseaseType+=","+one.getLabelName();
        }
        resultMap.put("diseaseType", StringUtils.isNotEmpty(diseaseType) ? diseaseType.substring(1) : "");//疾病类型
        List<SignPatientLabelInfo> labelHealthType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(patientCode,  "2", 1);
        String healthType="";
        for(SignPatientLabelInfo one:labelHealthType){
            healthType+=","+one.getLabelName();
        }
        resultMap.put("healthType", StringUtils.isNotEmpty(healthType) ? healthType.substring(1) : "");//健康情况
        List<SignPatientLabelInfo> labelServeType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(patientCode,  "2", 1);
        String serveType="";
        for(SignPatientLabelInfo one:labelServeType){
            serveType+=","+one.getLabelName();
        }
        resultMap.put("serveType", StringUtils.isNotEmpty(serveType)?serveType.substring(1) : "");//服务类型
        return resultMap;
    }
    /**
     * 任务进度
     * @param workorderCode