|
@ -63,18 +63,19 @@ public class FinishConsultJob implements Job {
|
|
|
.append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
|
|
|
.append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
|
|
|
.append("ORDER BY t.create_time");
|
|
|
JSONObject userAgent = new JSONObject();
|
|
|
userAgent.put("uid","admin");
|
|
|
userAgent.put("admin_token","0a5c5258-8863-4b07-a3f9-88c768528ab4");
|
|
|
userAgent.put("token","");
|
|
|
userAgent.put("imei","admin_imei");
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.toString());
|
|
|
list.stream().forEach(one->{
|
|
|
|
|
|
String topicId = one.get("topic_id").toString();
|
|
|
String topicName = one.get("topic_name").toString();
|
|
|
logger.info("Got topic to terminate, " + topicId + ": " + topicName + ", last active time: " + one.get("last_message_time"));
|
|
|
String response = httpUtil.sendLoginGet(server_url+"/doctor/consult/finish_consult","consult="+topicId,userAgent.toString());
|
|
|
logger.info("FinishConsultJob response....."+response);
|
|
|
try {
|
|
|
logger.info("Got topic to terminate, " + topicId + ": " + topicName + ", last active time: " + one.get("last_message_time"));
|
|
|
Integer response = finishConsult(topicId,"admin",2);
|
|
|
logger.info("FinishConsultJob response....."+response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
logger.info("FinishConsultJob 处理医生回复后,居民进入了咨询但是没有回复的 咨询也要自动结束.....");
|
|
@ -98,9 +99,13 @@ public class FinishConsultJob implements Job {
|
|
|
|
|
|
List<Map<String,Object>> temp = jdbcTemplate.queryForList(sql2.toString(),sessionId);
|
|
|
if(temp!=null&&temp.size()>=0){
|
|
|
logger.info("Got topic to terminate, " + topicId + ": " + topicName + ", last active time: " + one.get("last_message_time"));
|
|
|
String response = httpUtil.sendLoginGet(server_url+"/doctor/consult/finish_consult","consult="+topicId,userAgent.toString());
|
|
|
logger.info("FinishConsultJob response....."+response);
|
|
|
try {
|
|
|
logger.info("Got topic to terminate, " + topicId + ": " + topicName + ", last active time: " + one.get("last_message_time"));
|
|
|
Integer response = finishConsult(topicId,"admin",2);
|
|
|
logger.info("FinishConsultJob response....."+response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
@ -152,110 +157,6 @@ public class FinishConsultJob implements Job {
|
|
|
if (obj.getInteger("status") == -1) {
|
|
|
throw new RuntimeException(String.valueOf(obj.get("message")));
|
|
|
}
|
|
|
|
|
|
//结束咨询才发送推送给IM文字消息
|
|
|
// if (endType == 1) {
|
|
|
// BasePatientDO p = patientDao.findOne(endOperator);
|
|
|
// endName = p.getName();
|
|
|
// if (consultTeam.getType() == 2 || consultTeam.getType() == 8) {
|
|
|
// String openId = p.getOpenid();
|
|
|
//
|
|
|
// WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxpj");
|
|
|
// String first = templateConfig.getFirst();
|
|
|
// first = first.replace("key1", (endName == null ? "" : endName));
|
|
|
// String keyword1 = templateConfig.getKeyword1();
|
|
|
//
|
|
|
// org.json.JSONObject json = new org.json.JSONObject();
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
// json.put("keyword1", keyword1);
|
|
|
// json.put("keyword2", sdf.format(new Date()));
|
|
|
// json.put("toUser", p.getCode());
|
|
|
// json.put("represented", p.getCode());//被代理人
|
|
|
// json.put("remark", "");
|
|
|
// json.put("consult", consult);
|
|
|
// if (consultTeam.getType() == 8) {
|
|
|
// first = first.replace("key2", "续方");
|
|
|
// } else {
|
|
|
// first = first.replace("key2", "");
|
|
|
// }
|
|
|
// json.put("first", first);
|
|
|
// if (StringUtils.isNotBlank(p.getOpenid())) {
|
|
|
// pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, openId, p.getName(), json);
|
|
|
// } else {
|
|
|
// //发送代理人
|
|
|
// org.json.JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
|
|
|
// if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
// for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
// org.json.JSONObject j = jsonArray.getJSONObject(i);
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// org.json.JSONObject data = json;
|
|
|
// data.remove("toUser");
|
|
|
// data.put("toUser", member.getCode());
|
|
|
// data.remove("first");
|
|
|
// data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first);
|
|
|
// pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, member.getOpenid(), p.getName(), data);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// } else {
|
|
|
// if (consultTeam.getType() == 2 || consultTeam.getType() == 8) {
|
|
|
// Patient p = patientDao.findByCode(consultTeam.getPatient());
|
|
|
// String name = p.getName();
|
|
|
// String openId = p.getOpenid();
|
|
|
//
|
|
|
// WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxpj");
|
|
|
//
|
|
|
// if (endOperator.equals("admin")) {
|
|
|
// templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxcspj");
|
|
|
// }
|
|
|
// String first = templateConfig.getFirst();
|
|
|
// first = first.replace("key1", (name == null ? "" : name));
|
|
|
// String keyword1 = templateConfig.getKeyword1();
|
|
|
//
|
|
|
// org.json.JSONObject json = new org.json.JSONObject();
|
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
// json.put("keyword1", keyword1);
|
|
|
// json.put("keyword2", sdf.format(new Date()));
|
|
|
// json.put("toUser", p.getCode());
|
|
|
// json.put("represented", p.getCode());//被代理人
|
|
|
// json.put("remark", "");
|
|
|
// json.put("consult", consult);
|
|
|
//
|
|
|
// if (consultTeam.getType() == 8) {
|
|
|
// first += "续方";
|
|
|
// first = first.replace("key2", "续方");
|
|
|
// } else {
|
|
|
// first = first.replace("key2", "");
|
|
|
// }
|
|
|
// /*if (endOperator.equals("admin")) {
|
|
|
// first += "咨询超时未回复,系统自动关闭,请及时对咨询医生进行评价。";
|
|
|
// }else {
|
|
|
// first += "咨询已结束,请及时对咨询医生进行评价。";
|
|
|
// }*/
|
|
|
// json.put("first", first);
|
|
|
// if (StringUtils.isNotBlank(p.getOpenid())) {
|
|
|
// pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, openId, p.getName(), json);
|
|
|
// } else {
|
|
|
// //发送代理人
|
|
|
// org.json.JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
|
|
|
// if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
// for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
// org.json.JSONObject j = jsonArray.getJSONObject(i);
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// org.json.JSONObject data = json;
|
|
|
// data.remove("toUser");
|
|
|
// data.put("toUser", member.getCode());
|
|
|
// data.remove("first");
|
|
|
// data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first);
|
|
|
// pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, member.getOpenid(), p.getName(), data);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
consultTeam.setEndMsgId(obj.getString("id"));
|
|
|
cons.setEndTime(new Date());
|
|
|
consultTeam.setEndTime(new Date());
|