|
@ -14,6 +14,7 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
|
import com.yihu.jw.entity.care.doorCoach.*;
|
|
|
import com.yihu.jw.entity.care.lifeCare.LifeCareFeeDetailDO;
|
|
|
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
@ -143,6 +144,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
orderDO.setCreateUserName(orderDO.getProxyPatientName());
|
|
|
orderDO.setOrderInfo("0");
|
|
|
orderDO.setStatus(0);//待付款
|
|
|
orderDO.setPayStatus(0);//待付款
|
|
|
// orderDO.setConclusionStatus(1);
|
|
|
|
|
|
if(StringUtils.isEmpty(orderDO.getPatient())){
|
|
@ -163,7 +165,9 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
|
|
|
//已取消的订单也可以申请
|
|
|
boolean bool = baseDoorCoachOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
|
|
|
new Integer[]{BaseDoorCoachOrderDO.Status.waitForSend.getType(),
|
|
|
new Integer[]{
|
|
|
BaseDoorCoachOrderDO.Status.waitForPay.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.waitForSend.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.waitForAccept.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.waitForServe.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.accept.getType(),
|
|
@ -202,6 +206,11 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
@Transactional
|
|
|
public JSONObject proxyCreate(String jsonData,String doctorCode) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
//医养暂无该功能--屏蔽
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, "暂无该功能");
|
|
|
return result;
|
|
|
/*
|
|
|
JSONObject jsonObjectParam;
|
|
|
try {
|
|
|
jsonObjectParam = JSONObject.parseObject(jsonData);
|
|
@ -243,7 +252,8 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
if(StringUtils.isBlank(orderDO.getId())) {
|
|
|
//已取消的订单也可以申请
|
|
|
boolean bool = baseDoorCoachOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
|
|
|
new Integer[]{BaseDoorCoachOrderDO.Status.waitForAccept.getType(),
|
|
|
new Integer[]{BaseDoorCoachOrderDO.Status.waitForPay.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.waitForAccept.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.waitForServe.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.accept.getType(),
|
|
|
BaseDoorCoachOrderDO.Status.waitForSend.getType()
|
|
@ -279,6 +289,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
orderDO.setUpdateUserName(orderDO.getProxyPatientName());
|
|
|
}
|
|
|
orderDO.setStatus(0);//待付款
|
|
|
orderDO.setPayStatus(0);//待付款
|
|
|
orderDO.setType(3);
|
|
|
orderDO.setDispatcherResponseTime(new Date());
|
|
|
this.save(orderDO);
|
|
@ -292,24 +303,26 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
sendWeixinMessage(4,orderDO.getDoctor(),orderDO.getPatient());
|
|
|
|
|
|
//发起支付订单
|
|
|
payService.submitOrder(orderDO.getPatient(),"3",orderDO.getId(),orderDO.getTotalFee().doubleValue());
|
|
|
BusinessOrderDO businessOrderDO = payService.submitOrder(orderDO.getPatient(),"3",orderDO.getId(),orderDO.getTotalFee().doubleValue());
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
|
return result;
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
//支付完成后开始上门辅导订单
|
|
|
public JSONObject payOrderAfter(String orderId) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderId);
|
|
|
if (businessOrderDO==null){
|
|
|
String failMsg = "未查询到该订单";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
BaseDoorCoachOrderDO orderDO= baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO!=null){
|
|
|
if (businessOrderDO.getStatus() == 0){
|
|
|
try {
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderId);
|
|
|
if (businessOrderDO==null){
|
|
|
String failMsg = "未查询到该订单";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
BaseDoorCoachOrderDO orderDO= baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO!=null){
|
|
|
orderDO.setPayStatus(1);
|
|
|
orderDO.setPayWay(1);
|
|
|
orderDO.setPayTime(new Date());
|
|
|
if (orderDO.getType()== 3){//医生代预约
|
|
@ -370,16 +383,14 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.success);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
}
|
|
|
}else {
|
|
|
String failMsg = "订单已支付或已取消";
|
|
|
}
|
|
|
else {
|
|
|
String failMsg = "工单不存在";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
String failMsg = "工单不存在";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@ -387,19 +398,22 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
//退款后回调
|
|
|
public JSONObject refundOrderAfter(String orderId) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
BaseDoorCoachOrderDO orderDO= baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO == null){
|
|
|
String failMsg = "工单不存在";
|
|
|
try {
|
|
|
BaseDoorCoachOrderDO orderDO= baseDoorCoachOrderDao.findOne(orderId);
|
|
|
if (orderDO == null){
|
|
|
String failMsg = "工单不存在";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
orderDO.setPayStatus(2);
|
|
|
this.save(orderDO);
|
|
|
String failMsg = "success";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
orderDO.setStatus(-1);
|
|
|
orderDO.setPayWay(-1);
|
|
|
this.save(orderDO);
|
|
|
String failMsg = "success";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -842,7 +856,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
logger.error(failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
if(type==2){//患者仅未支付的订单能取消
|
|
|
if(type==2){//v0.5.1 患者仅未支付的订单能取消此时未正式开始工单,未创建咨询
|
|
|
if(orderDO.getStatus() != BaseDoorCoachOrderDO.Status.waitForPay.getType()){
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
String failMsg = "无法取消工单,已支付的工单需要到我的订单中进行取消," + orderId;
|
|
@ -851,16 +865,16 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return result;
|
|
|
}
|
|
|
}else{//调度员拒单,此时工单已支付抵达调度员
|
|
|
//触发退款流程,退款失败时无法取消工单
|
|
|
try {
|
|
|
if (orderDO.getStatus() > BaseDoorCoachOrderDO.Status.waitForPay.getType()&&1==orderDO.getPayWay()){
|
|
|
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(dispatcher)){
|
|
|
orderDO.setDoctor(dispatcher);
|
|
|
orderDO.setDoctorName(dispatcherName);
|
|
|
orderDO.setDispatcher(dispatcher);
|
|
|
orderDO.setDispatcherName(dispatcherName);
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderDO.getId());
|
|
|
if (businessOrderDO!=null){
|
|
|
if (1 == businessOrderDO.getStatus()){
|
|
|
//退款流程
|
|
|
payService.orderRefund(businessOrderDO.getOrderNo(),"调度员拒单退款");
|
|
|
orderDO.setPayStatus(2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//如果是调度员取消,推送IM取消工单json消息,
|
|
|
if (StringUtils.isNotBlank(dispatcher)){
|
|
@ -871,15 +885,12 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
if (!consultTeamService.finishConsult(orderDO.getId(),orderDO.getPatient(),orderDO.getPatient(),1)){
|
|
|
String failMsg = "咨询结束失败 无法取消工单";
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,failMsg);
|
|
|
return result;
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(dispatcher)){
|
|
|
orderDO.setDoctor(dispatcher);
|
|
|
orderDO.setDoctorName(dispatcherName);
|
|
|
orderDO.setDispatcher(dispatcher);
|
|
|
orderDO.setDispatcherName(dispatcherName);
|
|
|
}
|
|
|
|
|
|
if(type == BaseDoorCoachOrderDO.CancelType.dispatcher.getType()){
|
|
|
messageUtil.updateDoorCoachMessage(orderDO,new String[]{"702","703","730"},"732",dispatcher,dispatcher);
|
|
|
}
|
|
@ -897,10 +908,9 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
|
|
|
if (basePatientWechatDos.size()>0){
|
|
|
String openId = basePatientWechatDos.get(0).getOpenid();
|
|
|
messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,null,null,2,json, DateUtil.dateToChineseDate(new Date()),"上门预约已取消","已取消");
|
|
|
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
String failMsg = "退款失败,无法取消工单:," + orderId;
|
|
|
result.put(ResponseContant.resultMsg, failMsg);
|
|
|
return result;
|