|
|
@@ -8,6 +8,8 @@ import cn.hutool.json.JSONUtil;
|
|
|
import cn.jiguang.common.resp.APIConnectionException;
|
|
|
import cn.jiguang.common.resp.APIRequestException;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fs.common.constant.FsConstants;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
@@ -44,8 +46,10 @@ import com.fs.his.vo.*;
|
|
|
import com.fs.huifuPay.domain.HuiFuRefundResult;
|
|
|
import com.fs.huifuPay.sdk.opps.core.request.V2TradePaymentScanpayRefundRequest;
|
|
|
import com.fs.huifuPay.service.HuiFuService;
|
|
|
+import com.fs.im.config.IMConfig;
|
|
|
import com.fs.im.dto.*;
|
|
|
import com.fs.im.service.IImService;
|
|
|
+import com.fs.im.service.OpenIMService;
|
|
|
import com.fs.jpush.service.JpushService;
|
|
|
import com.fs.repeat.vo.RepeatUploadVo;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
@@ -180,6 +184,8 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigUtil configUtil;
|
|
|
+ @Autowired
|
|
|
+ private OpenIMService openIMService;
|
|
|
/**
|
|
|
* 查询问诊订单
|
|
|
*
|
|
|
@@ -641,7 +647,18 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
}
|
|
|
else if(param.getInquiryType().equals(2)){
|
|
|
//快速
|
|
|
-
|
|
|
+ FsDoctor doctor = null;
|
|
|
+ //获取销售绑定的医生信息
|
|
|
+ if (param.getCompanyUserId() != null) {
|
|
|
+ CompanyUser companyUser = companyUserService.selectCompanyUserById(param.getCompanyUserId());
|
|
|
+ if (companyUser != null && companyUser.getDoctorId() != null) {
|
|
|
+ doctor = doctorMapper.selectFsDoctorByDoctorId(companyUser.getDoctorId());
|
|
|
+ if (doctor != null) {
|
|
|
+ order.setDoctorId(doctor.getDoctorId());
|
|
|
+ order.setDepartmentId(doctor.getDeptId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
List<FsPriceDTO> price = configDTO.getPrices().stream().filter(x -> x.getType().equals(param.getOrderType())).collect(Collectors.toList());
|
|
|
if(price!=null&&price.size()==1){
|
|
|
order.setMoney(price.get(0).getPrice());
|
|
|
@@ -660,6 +677,9 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
report.setPatientJson(JSONUtil.toJsonStr(dto));
|
|
|
report.setReportSn(reportSn);
|
|
|
report.setStatus(1);
|
|
|
+ if (doctor != null) {
|
|
|
+ report.setDoctorId(doctor.getDoctorId());
|
|
|
+ }
|
|
|
order.setIsAudit(1);
|
|
|
}
|
|
|
else{
|
|
|
@@ -674,9 +694,13 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
report.setPatientJson(JSONUtil.toJsonStr(dto));
|
|
|
report.setReportSn(reportSn);
|
|
|
report.setStatus(0);
|
|
|
+ if (doctor != null) {
|
|
|
+ report.setDoctorId(doctor.getDoctorId());
|
|
|
+ }
|
|
|
order.setIsAudit(0);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
else if(param.getInquiryType().equals(3)){
|
|
|
//开药
|
|
|
@@ -870,7 +894,7 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
@Override
|
|
|
@Transactional
|
|
|
@Synchronized
|
|
|
- public R acceptOrder(FsInquiryOrderAcceptParam param) {
|
|
|
+ public R acceptOrder(FsInquiryOrderAcceptParam param) throws JsonProcessingException {
|
|
|
FsInquiryOrder order=fsInquiryOrderMapper.selectFsInquiryOrderByOrderId(param.getOrderId());
|
|
|
if(!order.getStatus().equals(FsInquiryOrderStatusEnum.STATUS_2.getValue())){
|
|
|
return R.error("非法操作");
|
|
|
@@ -913,32 +937,44 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- MsgDTO msgDTO=new MsgDTO();
|
|
|
+ //MsgDTO msgDTO=new MsgDTO();
|
|
|
MsgCustomDTO customDTO=new MsgCustomDTO();
|
|
|
customDTO.setType("startInquiry");
|
|
|
customDTO.setOrderType(order.getOrderType());
|
|
|
customDTO.setOrderId(order.getOrderId().toString());
|
|
|
customDTO.setImType(1);
|
|
|
- msgDTO.setCloudCustomData(JSONUtil.toJsonStr(customDTO));
|
|
|
+ /*msgDTO.setCloudCustomData(JSONUtil.toJsonStr(customDTO));
|
|
|
msgDTO.setFrom_Account("D-"+param.getDoctorId());
|
|
|
- msgDTO.setTo_Account("U-"+order.getUserId());
|
|
|
- List<MsgDataDTO> msgs=new ArrayList<>();
|
|
|
+ msgDTO.setTo_Account("U-"+order.getUserId());*/
|
|
|
+ /*List<MsgDataDTO> msgs=new ArrayList<>();
|
|
|
MsgDataDTO msg=new MsgDataDTO();
|
|
|
- msg.setMsgType("TIMCustomElem");
|
|
|
+ msg.setMsgType("TIMCustomElem");*/
|
|
|
FsDoctor doctor=doctorMapper.selectFsDoctorByDoctorId(param.getDoctorId());
|
|
|
String doc="医生";
|
|
|
if (doctor.getDeptId()!=null&&doctor.getDeptId().compareTo(39L)==0){
|
|
|
doc="药师";
|
|
|
}
|
|
|
- InquiryOrderMsgDTO inquiryOrderMsgDTO=new InquiryOrderMsgDTO();
|
|
|
+ /*InquiryOrderMsgDTO inquiryOrderMsgDTO=new InquiryOrderMsgDTO();
|
|
|
inquiryOrderMsgDTO.setTitle(doctor.getDoctorName()+doc+"为您服务");
|
|
|
String ext= JSONUtil.toJsonStr(inquiryOrderMsgDTO);
|
|
|
msg.setMsgContent(new MsgDataFormatDTO("startInquiry",ext,order.getOrderId().toString()));
|
|
|
msgs.add(msg);
|
|
|
- msgDTO.setMsgBody(msgs);
|
|
|
- imService.sendMsg(msgDTO);
|
|
|
-
|
|
|
-
|
|
|
+ msgDTO.setMsgBody(msgs);*/
|
|
|
+ //imService.sendMsg(msgDTO);
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ String ex = objectMapper.writeValueAsString(customDTO);
|
|
|
+ openIMService.sendUtil("D"+param.getDoctorId(),"U"+order.getUserId(),110,"startInquiry","",doctor.getDoctorName()+doc+"为您服务","","","");
|
|
|
+ /*OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO.setSendID("D"+param.getDoctorId().toString());
|
|
|
+ openImMsgDTO.setRecvID("U"+order.getUserId().toString());
|
|
|
+ openImMsgDTO.setContentType(110);
|
|
|
+ openImMsgDTO.setSenderPlatformID(5);
|
|
|
+ openImMsgDTO.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content content = new OpenImMsgDTO.Content();
|
|
|
+ content.setContent(ext);
|
|
|
+ openImMsgDTO.setContent(content);
|
|
|
+ openImMsgDTO.setEx(customDTO);
|
|
|
+ openIMService.openIMSendMsg(openImMsgDTO);*/
|
|
|
if (doc.equals("药师")){
|
|
|
MsgDTO msgDTO1=new MsgDTO();
|
|
|
MsgCustomDTO customDTO1=new MsgCustomDTO();
|
|
|
@@ -956,7 +992,22 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
msg1.setMsgContent(dto1);
|
|
|
msgs1.add(msg1);
|
|
|
msgDTO1.setMsgBody(msgs1);
|
|
|
- imService.sendMsg(msgDTO1);
|
|
|
+ //imService.sendMsg(msgDTO1);
|
|
|
+
|
|
|
+ ObjectMapper objectMapper1 = new ObjectMapper();
|
|
|
+ String ex1 = objectMapper.writeValueAsString(customDTO1);
|
|
|
+ openIMService.sendUtil("D"+param.getDoctorId(),"U"+order.getUserId(),110,"startInquiry","","您好,我是芸医汇互联网医院执业药师,请问您有什么问题想咨询?","","",ex1);
|
|
|
+ /*OpenImMsgDTO openImMsgDTO1 = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO1.setSendID("D"+param.getDoctorId().toString());
|
|
|
+ openImMsgDTO1.setRecvID("U"+order.getUserId().toString());
|
|
|
+ openImMsgDTO1.setContentType(101);
|
|
|
+ openImMsgDTO1.setSenderPlatformID(5);
|
|
|
+ openImMsgDTO1.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content content1 = new OpenImMsgDTO.Content();
|
|
|
+ content1.setContent(ext);
|
|
|
+ openImMsgDTO1.setContent(content1);
|
|
|
+ openImMsgDTO1.setEx(customDTO);
|
|
|
+ openIMService.openIMSendMsg(openImMsgDTO1);*/
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1010,7 +1061,7 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public R receiveOrder(FsInquiryOrderReceiveParam param) {
|
|
|
+ public R receiveOrder(FsInquiryOrderReceiveParam param) throws JsonProcessingException {
|
|
|
FsInquiryOrder order=fsInquiryOrderMapper.selectFsInquiryOrderByOrderId(param.getOrderId());
|
|
|
if(!order.getStatus().equals(FsInquiryOrderStatusEnum.STATUS_2.getValue())){
|
|
|
return R.error("非法操作");
|
|
|
@@ -1073,7 +1124,21 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
msg.setMsgContent(new MsgDataFormatDTO("startInquiry",ext,order.getOrderId().toString()));
|
|
|
msgs.add(msg);
|
|
|
msgDTO.setMsgBody(msgs);
|
|
|
- imService.sendMsg(msgDTO);
|
|
|
+ //imService.sendMsg(msgDTO);
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ String ex = objectMapper.writeValueAsString(customDTO);
|
|
|
+ openIMService.sendUtil("D"+order.getDoctorId(),"U"+order.getUserId(),110,"startInquiry","",doctor.getDoctorName()+doc+"为您服务","","",ex);
|
|
|
+ /*OpenImMsgDTO openImMsgDTO = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO.setSendID("D"+order.getDoctorId().toString());
|
|
|
+ openImMsgDTO.setRecvID("U"+order.getUserId().toString());
|
|
|
+ openImMsgDTO.setContentType(110);
|
|
|
+ openImMsgDTO.setSenderPlatformID(5);
|
|
|
+ openImMsgDTO.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content content = new OpenImMsgDTO.Content();
|
|
|
+ content.setContent(ext);
|
|
|
+ openImMsgDTO.setContent(content);
|
|
|
+ openImMsgDTO.setEx(customDTO);
|
|
|
+ openIMService.openIMSendMsg(openImMsgDTO);*/
|
|
|
if (doc.equals("药师")){
|
|
|
MsgDTO msgDTO1=new MsgDTO();
|
|
|
MsgCustomDTO customDTO1=new MsgCustomDTO();
|
|
|
@@ -1091,7 +1156,22 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
msg1.setMsgContent(dto1);
|
|
|
msgs1.add(msg1);
|
|
|
msgDTO1.setMsgBody(msgs1);
|
|
|
- imService.sendMsg(msgDTO1);
|
|
|
+ //imService.sendMsg(msgDTO1);
|
|
|
+
|
|
|
+ ObjectMapper objectMapper1 = new ObjectMapper();
|
|
|
+ String ex1 = objectMapper.writeValueAsString(customDTO1);
|
|
|
+ openIMService.sendUtil("D"+param.getDoctorId(),"U"+order.getUserId(),110,"startInquiry","","您好,我是芸医汇互联网医院执业药师,请问您有什么问题想咨询?","","",ex1);
|
|
|
+ /* OpenImMsgDTO openImMsgDTO1 = new OpenImMsgDTO();
|
|
|
+ openImMsgDTO1.setSendID("D"+order.getDoctorId().toString());
|
|
|
+ openImMsgDTO1.setRecvID("U"+order.getUserId().toString());
|
|
|
+ openImMsgDTO1.setContentType(110);
|
|
|
+ openImMsgDTO1.setSenderPlatformID(5);
|
|
|
+ openImMsgDTO1.setSessionType(1);
|
|
|
+ OpenImMsgDTO.Content content1 = new OpenImMsgDTO.Content();
|
|
|
+ content1.setContent(ext);
|
|
|
+ openImMsgDTO1.setContent(content1);
|
|
|
+ openImMsgDTO1.setEx(customDTO);
|
|
|
+ openIMService.openIMSendMsg(openImMsgDTO1);*/
|
|
|
}
|
|
|
//发送给医生
|
|
|
// MsgDTO msgDTO1=new MsgDTO();
|
|
|
@@ -1188,7 +1268,7 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public R finishOrder(FsInquiryOrderFinishParam param) {
|
|
|
+ public R finishOrder(FsInquiryOrderFinishParam param) throws JsonProcessingException {
|
|
|
FsInquiryOrder order=fsInquiryOrderMapper.selectFsInquiryOrderByOrderId(param.getOrderId());
|
|
|
if(!order.getStatus().equals(FsInquiryOrderStatusEnum.STATUS_3.getValue())){
|
|
|
return R.error("非法操作");
|
|
|
@@ -1228,7 +1308,11 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
msg.setMsgContent(new MsgDataFormatDTO("finishInquiry",ext,order.getOrderId().toString()));
|
|
|
msgs.add(msg);
|
|
|
msgDTO.setMsgBody(msgs);
|
|
|
- imService.sendMsg(msgDTO);
|
|
|
+ //imService.sendMsg(msgDTO);
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ String ex = objectMapper.writeValueAsString(customDTO);
|
|
|
+ openIMService.sendUtil("D"+order.getDoctorId(),"U"+order.getUserId(),110,"finishInquiry","","医生完成订单","","",ex);
|
|
|
+
|
|
|
//发送给医生
|
|
|
// MsgDTO msgDTO1=new MsgDTO();
|
|
|
// MsgCustomDTO customDTO1=new MsgCustomDTO();
|
|
|
@@ -1258,7 +1342,7 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
}
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public R autoFinishOrder(FsInquiryOrderFinishParam param) {
|
|
|
+ public R autoFinishOrder(FsInquiryOrderFinishParam param) throws JsonProcessingException {
|
|
|
FsInquiryOrder order=fsInquiryOrderMapper.selectFsInquiryOrderByOrderId(param.getOrderId());
|
|
|
if(!order.getStatus().equals(FsInquiryOrderStatusEnum.STATUS_3.getValue())){
|
|
|
return R.error("非法操作");
|
|
|
@@ -1297,7 +1381,11 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
msg.setMsgContent(new MsgDataFormatDTO("finishInquiry",ext,order.getOrderId().toString()));
|
|
|
msgs.add(msg);
|
|
|
msgDTO.setMsgBody(msgs);
|
|
|
- imService.sendMsg(msgDTO);
|
|
|
+ //imService.sendMsg(msgDTO);
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ String ex = objectMapper.writeValueAsString(customDTO);
|
|
|
+ openIMService.sendUtil("D"+order.getDoctorId(),"U"+order.getUserId(),110,"finishInquiry","","医生完成订单","","",ex);
|
|
|
+
|
|
|
redisTemplate.delete("DrugReport:doctorId:" + order.getDoctorId() + ":userId:" + order.getUserId());
|
|
|
return R.ok();
|
|
|
}
|
|
|
@@ -1579,7 +1667,7 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String sendStartMsg(Long orderId) {
|
|
|
+ public String sendStartMsg(Long orderId) throws JsonProcessingException {
|
|
|
|
|
|
FsInquiryOrder order = fsInquiryOrderMapper.selectFsInquiryOrderByOrderId(orderId);
|
|
|
MsgDTO msgDTO=new MsgDTO();
|
|
|
@@ -1601,7 +1689,12 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
|
|
|
msg.setMsgContent(new MsgDataFormatDTO("startInquiry",ext,order.getOrderId().toString()));
|
|
|
msgs.add(msg);
|
|
|
msgDTO.setMsgBody(msgs);
|
|
|
- imService.sendMsg(msgDTO);
|
|
|
+ //imService.sendMsg(msgDTO);
|
|
|
+
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ String ex = objectMapper.writeValueAsString(customDTO);
|
|
|
+ openIMService.sendUtil("D"+order.getDoctorId(),"U"+order.getUserId(),110,"startInquiry","1","为您服务","","",ex);
|
|
|
+
|
|
|
return "OK";
|
|
|
}
|
|
|
|