|
@ -1,5 +1,6 @@
|
|
package com.yihu.jw.hospital.module.door.service;
|
|
package com.yihu.jw.hospital.module.door.service;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.yihu.fastdfs.FastDFSUtil;
|
|
import com.yihu.fastdfs.FastDFSUtil;
|
|
@ -11,7 +12,6 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
import com.yihu.jw.entity.door.*;
|
|
import com.yihu.jw.entity.door.*;
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
|
|
import com.yihu.jw.file_upload.FileUploadService;
|
|
import com.yihu.jw.file_upload.FileUploadService;
|
|
import com.yihu.jw.hospital.HospitalDao;
|
|
import com.yihu.jw.hospital.HospitalDao;
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
@ -664,7 +664,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
/**
|
|
/**
|
|
* 创建上门服务工单
|
|
* 创建上门服务工单
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
public JSONObject create(String jsonData) throws Exception {
|
|
public JSONObject create(String jsonData) throws Exception {
|
|
logger.info("创建上门服务jsonData参数:" + jsonData);
|
|
logger.info("创建上门服务jsonData参数:" + jsonData);
|
|
|
|
|
|
@ -762,50 +762,50 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
boolean flag = true;
|
|
boolean flag = true;
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
//创建订单信息
|
|
|
|
BasePatientDO pateint = patientDao.findById(orderDO.getPatient());
|
|
|
|
//查询是否存在订单信息
|
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.findByOrderId(orderDO.getId());
|
|
|
|
if (businessOrderDO == null) {
|
|
|
|
businessOrderDO = new BusinessOrderDO();
|
|
|
|
businessOrderDO.setPatient(pateint.getId());
|
|
|
|
//支付账号
|
|
|
|
businessOrderDO.setYkOrderId(pateint.getMobile());
|
|
|
|
businessOrderDO.setPatientName(pateint.getName());
|
|
|
|
businessOrderDO.setOrderType(1);
|
|
|
|
businessOrderDO.setOrderCategory(type);
|
|
|
|
Date date = new Date();
|
|
|
|
Long lastPayTime = date.getTime() + 1000 * 60 * 30;//订单截至支付日期
|
|
|
|
businessOrderDO.setDescription("上门服务");
|
|
|
|
businessOrderDO.setRelationCode(orderDO.getId());//订单id
|
|
|
|
businessOrderDO.setRelationName("上门服务");
|
|
|
|
businessOrderDO.setCreateTime(date);
|
|
|
|
businessOrderDO.setUpdateTime(date);
|
|
|
|
businessOrderDO.setStatus(0);
|
|
|
|
businessOrderDO.setOrderNo(orderDO.getNumber());
|
|
|
|
businessOrderDO.setUploadStatus(0);
|
|
|
|
businessOrderDO.setPayType(1);
|
|
|
|
businessOrderDO.setPayPrice(Double.valueOf(orderDO.getTotalFee().doubleValue()));
|
|
|
|
businessOrderDO.setLastPayTime(lastPayTime);
|
|
|
|
} else {
|
|
|
|
/**
|
|
|
|
* 暂时没用,线下付款的
|
|
|
|
* 1、是否付款完成
|
|
|
|
* 2、判断付款时间是否超过时长了--还需要定时任务监听订单修改状态,把未付款改成已取消
|
|
|
|
*/
|
|
|
|
// if (businessOrderDO.getStatus() != 1) {
|
|
|
|
// long nowTime = System.currentTimeMillis();
|
|
|
|
// Long lastPayTime = businessOrderDO.getLastPayTime();
|
|
|
|
// if (lastPayTime > nowTime) {
|
|
|
|
// //超时了 修改工单状态成已取消
|
|
|
|
// orderDO.setStatus(-1);//-已取消
|
|
|
|
// wlyyDoorServiceOrderDao.save(orderDO);//更新上门工单
|
|
|
|
// businessOrderDO.setStatus(2);//已取消
|
|
|
|
// businessOrderDao.save(businessOrderDO);//更新业务表
|
|
|
|
// flag = false;//不用创建咨询内容
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
// //创建订单信息
|
|
|
|
// BasePatientDO pateint = patientDao.findById(orderDO.getPatient());
|
|
|
|
// //查询是否存在订单信息
|
|
|
|
// BusinessOrderDO businessOrderDO = businessOrderDao.findByOrderId(orderDO.getId());
|
|
|
|
// if (businessOrderDO == null) {
|
|
|
|
// businessOrderDO = new BusinessOrderDO();
|
|
|
|
// businessOrderDO.setPatient(pateint.getId());
|
|
|
|
// //支付账号
|
|
|
|
// businessOrderDO.setYkOrderId(pateint.getMobile());
|
|
|
|
// businessOrderDO.setPatientName(pateint.getName());
|
|
|
|
// businessOrderDO.setOrderType(1);
|
|
|
|
// businessOrderDO.setOrderCategory(type);
|
|
|
|
// Date date = new Date();
|
|
|
|
// Long lastPayTime = date.getTime() + 1000 * 60 * 30;//订单截至支付日期
|
|
|
|
// businessOrderDO.setDescription("上门服务");
|
|
|
|
// businessOrderDO.setRelationCode(orderDO.getId());//订单id
|
|
|
|
// businessOrderDO.setRelationName("上门服务");
|
|
|
|
// businessOrderDO.setCreateTime(date);
|
|
|
|
// businessOrderDO.setUpdateTime(date);
|
|
|
|
// businessOrderDO.setStatus(0);
|
|
|
|
// businessOrderDO.setOrderNo(orderDO.getNumber());
|
|
|
|
// businessOrderDO.setUploadStatus(0);
|
|
|
|
// businessOrderDO.setPayType(1);
|
|
|
|
// businessOrderDO.setPayPrice(Double.valueOf(orderDO.getTotalFee().doubleValue()));
|
|
|
|
// businessOrderDO.setLastPayTime(lastPayTime);
|
|
|
|
// } else {
|
|
|
|
// /**
|
|
|
|
// * 暂时没用,线下付款的
|
|
|
|
// * 1、是否付款完成
|
|
|
|
// * 2、判断付款时间是否超过时长了--还需要定时任务监听订单修改状态,把未付款改成已取消
|
|
|
|
// */
|
|
|
|
//// if (businessOrderDO.getStatus() != 1) {
|
|
|
|
//// long nowTime = System.currentTimeMillis();
|
|
|
|
//// Long lastPayTime = businessOrderDO.getLastPayTime();
|
|
|
|
//// if (lastPayTime > nowTime) {
|
|
|
|
//// //超时了 修改工单状态成已取消
|
|
|
|
//// orderDO.setStatus(-1);//-已取消
|
|
|
|
//// wlyyDoorServiceOrderDao.save(orderDO);//更新上门工单
|
|
|
|
//// businessOrderDO.setStatus(2);//已取消
|
|
|
|
//// businessOrderDao.save(businessOrderDO);//更新业务表
|
|
|
|
//// flag = false;//不用创建咨询内容
|
|
|
|
//// }
|
|
|
|
//// }
|
|
|
|
// }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 1、费用0时无需支付
|
|
* 1、费用0时无需支付
|
|
@ -825,7 +825,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
// }
|
|
// }
|
|
|
|
|
|
//保存业务表
|
|
//保存业务表
|
|
businessOrderDao.save(businessOrderDO);
|
|
|
|
|
|
// businessOrderDao.save(businessOrderDO);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 目前是线下付款的
|
|
* 目前是线下付款的
|
|
@ -838,6 +838,13 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
//创建咨询
|
|
//创建咨询
|
|
JSONObject successOrNot = consultTeamService.addDoorServiceConsult(orderDO.getId());
|
|
JSONObject successOrNot = consultTeamService.addDoorServiceConsult(orderDO.getId());
|
|
ConsultTeamDo consultTeam = (ConsultTeamDo) successOrNot.get(ResponseContant.resultMsg);
|
|
ConsultTeamDo consultTeam = (ConsultTeamDo) successOrNot.get(ResponseContant.resultMsg);
|
|
|
|
|
|
|
|
System.out.println("===调度员的信息开始======");
|
|
|
|
for (Map<String, Object> map : dispatcherList) {
|
|
|
|
System.out.println("调度员=>" + JSON.toJSONString(map));
|
|
|
|
}
|
|
|
|
System.out.println("===调度员的信息结束======");
|
|
|
|
|
|
//判断其是否有分配执行人。如果有不用走调度平台
|
|
//判断其是否有分配执行人。如果有不用走调度平台
|
|
if (StringUtils.isNotBlank(orderDO.getDoctor())) {
|
|
if (StringUtils.isNotBlank(orderDO.getDoctor())) {
|
|
orderDO.setStatus(2);//待接单
|
|
orderDO.setStatus(2);//待接单
|
|
@ -880,9 +887,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
JSONObject orderInfoContent = this.queryOrderCardInfo(orderDO);
|
|
JSONObject orderInfoContent = this.queryOrderCardInfo(orderDO);
|
|
orderInfoContent.put("re_msg_type", 0);//居民预约
|
|
orderInfoContent.put("re_msg_type", 0);//居民预约
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("准备发送预约卡片信息");
|
|
int flagCount = qucikSendIM(orderDO.getId(), "system", "智能助手", "2101", orderInfoContent.toJSONString());
|
|
int flagCount = qucikSendIM(orderDO.getId(), "system", "智能助手", "2101", orderInfoContent.toJSONString());
|
|
|
|
|
|
|
|
System.out.println("flagCount==>" + flagCount);
|
|
|
|
|
|
//模拟一,重试3次
|
|
//模拟一,重试3次
|
|
// int tryCount = 3;
|
|
// int tryCount = 3;
|
|
@ -1384,8 +1391,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
String sql = "SELECT " +
|
|
String sql = "SELECT " +
|
|
" d.photo AS doctorPhoto, " +
|
|
" d.photo AS doctorPhoto, " +
|
|
" d.`name` AS doctorName, " +
|
|
" d.`name` AS doctorName, " +
|
|
" d.`job_name` AS doctorJobName, " +
|
|
|
|
" d.hospital_name AS hospitalName, " +
|
|
|
|
|
|
" d.`job_title_name` AS doctorJobName, " +
|
|
|
|
" d.visit_hospital_name AS hospitalName, " +
|
|
" d.mobile AS doctorPhone, " +
|
|
" d.mobile AS doctorPhone, " +
|
|
" o.id, " +
|
|
" o.id, " +
|
|
" o.number, " +
|
|
" o.number, " +
|
|
@ -1400,8 +1407,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
" o.sign_id 'signId' , o.package_id 'packageId' " +
|
|
" o.sign_id 'signId' , o.package_id 'packageId' " +
|
|
" FROM " +
|
|
" FROM " +
|
|
" ( wlyy_door_service_order o " +
|
|
" ( wlyy_door_service_order o " +
|
|
" LEFT JOIN wlyy_doctor d ON o.doctor = d.`code`) " +
|
|
|
|
" LEFT JOIN wlyy_door_fee_detail de on o.id = de.order_id " +
|
|
|
|
|
|
" LEFT JOIN base_doctor d ON o.doctor = d.`id`) " +
|
|
|
|
" LEFT JOIN wlyy_door_fee_detail de on o.id = de.order_id and de.type='1' " +
|
|
" LEFT JOIN base_org a on o.hospital = a.code " +
|
|
" LEFT JOIN base_org a on o.hospital = a.code " +
|
|
" WHERE " +
|
|
" WHERE " +
|
|
" (o.patient = '{patient}') " +
|
|
" (o.patient = '{patient}') " +
|
|
@ -1419,7 +1426,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
" count(DISTINCT o.id) " +
|
|
" count(DISTINCT o.id) " +
|
|
" FROM " +
|
|
" FROM " +
|
|
" ( wlyy_door_service_order o " +
|
|
" ( wlyy_door_service_order o " +
|
|
" LEFT JOIN wlyy_doctor d ON o.doctor = d.`code`) " +
|
|
|
|
|
|
" LEFT JOIN base_doctor d ON o.doctor = d.`id`) " +
|
|
" LEFT JOIN wlyy_door_fee_detail de on o.id = de.order_id " +
|
|
" LEFT JOIN wlyy_door_fee_detail de on o.id = de.order_id " +
|
|
" LEFT JOIN base_org a on o.hospital = a.code " +
|
|
" LEFT JOIN base_org a on o.hospital = a.code " +
|
|
" WHERE " +
|
|
" WHERE " +
|
|
@ -2640,9 +2647,22 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
|
|
|
|
|
|
|
|
public int sendMsg(String orderId, String sendId, String sendName, String contentType, String content) throws Exception {
|
|
public int sendMsg(String orderId, String sendId, String sendName, String contentType, String content) throws Exception {
|
|
|
|
|
|
|
|
System.out.println("发送消息的方法【sendMsg】");
|
|
int result = -1;
|
|
int result = -1;
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
|
|
|
System.out.println("查询ConsultDo==>参数:" + orderId);
|
|
|
|
String sql = "SELECT * FROM wlyy_consult WHERE relation_code='" + orderId + "'";
|
|
|
|
|
|
|
|
ConsultDo consult = null;
|
|
|
|
List<ConsultDo> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ConsultDo.class));
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
consult = list.get(0);
|
|
|
|
System.out.println("ConsultDo的list数量==>" + list.size());
|
|
|
|
} else {
|
|
|
|
throw new Exception("ConsultDo为空,参数RelationCode:" + orderId);
|
|
|
|
}
|
|
|
|
// ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
|
|
|
|
|
System.out.println("方法:【sendMsg】 内容:consult==>" + JSON.toJSONString(consult));
|
|
if (null == consult) {
|
|
if (null == consult) {
|
|
System.out.println("当前工单未关联咨询,工单id:" + orderId);
|
|
System.out.println("当前工单未关联咨询,工单id:" + orderId);
|
|
return result;
|
|
return result;
|
|
@ -2651,6 +2671,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
String response = null;
|
|
String response = null;
|
|
if (StringUtils.isBlank(sendId)) {
|
|
if (StringUtils.isBlank(sendId)) {
|
|
WlyyDoorServiceOrderDO wlyyDoorServiceOrder = wlyyDoorServiceOrderDao.findOne(orderId);
|
|
WlyyDoorServiceOrderDO wlyyDoorServiceOrder = wlyyDoorServiceOrderDao.findOne(orderId);
|
|
|
|
System.out.println("方法:【wlyyDoorServiceOrder】 内容:consult==>" + JSON.toJSONString(consult));
|
|
String sender = "system";
|
|
String sender = "system";
|
|
if (StringUtils.isNoneBlank(wlyyDoorServiceOrder.getDispatcher())) {
|
|
if (StringUtils.isNoneBlank(wlyyDoorServiceOrder.getDispatcher())) {
|
|
sender = wlyyDoorServiceOrder.getDispatcher();
|
|
sender = wlyyDoorServiceOrder.getDispatcher();
|
|
@ -2659,6 +2680,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
|
|
} else {
|
|
} else {
|
|
response = imUtill.sendTopicIM(sendId, sendName, consult.getId(), contentType, content, null);
|
|
response = imUtill.sendTopicIM(sendId, sendName, consult.getId(), contentType, content, null);
|
|
}
|
|
}
|
|
|
|
System.out.println("sendTopicIM结果==>" + response);
|
|
JSONObject resObj = JSONObject.parseObject(response);
|
|
JSONObject resObj = JSONObject.parseObject(response);
|
|
if (resObj.getIntValue("status") == -1) {
|
|
if (resObj.getIntValue("status") == -1) {
|
|
String msg = "上门服务工单消息发送失败:" + resObj.getString("message");
|
|
String msg = "上门服务工单消息发送失败:" + resObj.getString("message");
|