|
@ -1,9 +1,7 @@
|
|
|
package com.yihu.wlyy.service.synergy;
|
|
|
|
|
|
import com.yihu.wlyy.entity.Patient;
|
|
|
import com.yihu.wlyy.entity.SignFamily;
|
|
|
import com.yihu.wlyy.entity.SignPatientLabelInfo;
|
|
|
import com.yihu.wlyy.entity.User;
|
|
|
import com.yihu.wlyy.entity.*;
|
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkordeReminderDO;
|
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
|
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
|
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
|
|
@ -604,4 +602,138 @@ public class SynergyManageService extends BaseJpaService {
|
|
|
}
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查找该客服该工单是否有异常工单
|
|
|
* @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
|
|
|
* @param userCode
|
|
|
*/
|
|
|
public void workorderRate(String workorderCode,String userCode){
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
//完成情况
|
|
|
//1、有效
|
|
|
Integer validCount = workorderServicerDao.findByWorkorderCodeCount(workorderCode,3);
|
|
|
resultMap.put("validCount",validCount);
|
|
|
//2、无效
|
|
|
resultMap.put("invalidCount","");
|
|
|
//3、总数
|
|
|
ManageSynergyWorkorderDO manageSynergyWorkorder = workOrderDao.findByCode(workorderCode);
|
|
|
resultMap.put("allCount",manageSynergyWorkorder.getServicerCount());
|
|
|
//我已完成
|
|
|
Integer myFinishedCount = workorderServicerDao.countByWorkorderCodeAndExecutorCodeAndStatus(workorderCode,userCode,3);
|
|
|
resultMap.put("myFinishedCount",myFinishedCount);
|
|
|
//待跟进
|
|
|
resultMap.put("followCount","");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 催单
|
|
|
* @param workorderServicerCode
|
|
|
* @param userCode
|
|
|
* @param userType
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Transactional
|
|
|
public void reminder(String workorderServicerCode,String userCode,Integer userType) throws Exception{
|
|
|
|
|
|
ManageSynergyWorkorderServicerDO manageSynergyWorkorderServicerDO = workorderServicerDao.findByCode(workorderServicerCode);
|
|
|
if(manageSynergyWorkorderServicerDO==null){
|
|
|
throw new Exception();
|
|
|
}
|
|
|
ManageSynergyWorkordeReminderDO workordeReminderDO = new ManageSynergyWorkordeReminderDO();
|
|
|
workordeReminderDO.setCode(getCode());
|
|
|
workordeReminderDO.setWorkorderCode(manageSynergyWorkorderServicerDO.getWorkorderCode());
|
|
|
workordeReminderDO.setServicePatientCode(workorderServicerCode);
|
|
|
workordeReminderDO.setCreateUser(userCode);
|
|
|
//创建人类型(1、医生,2、客服,3、客服负责人)
|
|
|
if(userType==1){
|
|
|
Doctor doctor = doctorDao.findByCode(userCode);
|
|
|
workordeReminderDO.setCreateUserName(doctor.getName());
|
|
|
}else if(userType==2||userType==3){
|
|
|
User user = userDao.findByCode(userCode);
|
|
|
workordeReminderDO.setCreateUserName(user.getName());
|
|
|
}
|
|
|
workordeReminderDO.setCreateUserType(userType);
|
|
|
workordeReminderDO.setHospital(manageSynergyWorkorderServicerDO.getHospital());
|
|
|
workordeReminderDO.setHospitalName(manageSynergyWorkorderServicerDO.getHospitalName());
|
|
|
workordeReminderDO.setCreateTime(new Date());
|
|
|
List<ManageSynergyWorkorderExecutorDO> list = workorderExecutorDao.findByWorkorderCode(manageSynergyWorkorderServicerDO.getWorkorderCode(),1);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
workordeReminderDO.setPrincipalCode(list.get(0).getExecutorCode());
|
|
|
workordeReminderDO.setPrincipalName(list.get(0).getExecutorName());
|
|
|
}
|
|
|
workordeReminderDO.setWorkorderType(manageSynergyWorkorderServicerDO.getWorkorderType());
|
|
|
workordeReminderDO.setRelationCode(manageSynergyWorkorderServicerDO.getRelationCode());
|
|
|
workordeReminderDO.setRelationCodeName(manageSynergyWorkorderServicerDO.getRelationCodeName());
|
|
|
ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(manageSynergyWorkorderServicerDO.getWorkorderCode());
|
|
|
|
|
|
workordeReminderDO.setServiceTime(manageSynergyWorkorderDO!=null?manageSynergyWorkorderDO.getServiceTime():null);
|
|
|
workordeReminderDO.setServicerKey(manageSynergyWorkorderDO!=null?manageSynergyWorkorderDO.getServicerKey():null);
|
|
|
workordeReminderDO.setWorkorderRemark(manageSynergyWorkorderDO!=null?manageSynergyWorkorderDO.getRemark():null);
|
|
|
workordeReminderDO.setDealWith(0);
|
|
|
manageSynergyWorkorderReminderDao.save(workordeReminderDO);
|
|
|
}
|
|
|
}
|