|
@ -12,6 +12,7 @@ import com.yihu.jw.entity.base.system.SystemDictDO;
|
|
|
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
|
import com.yihu.jw.entity.door.*;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.entity.wechat.WechatTemplateConfig;
|
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
|
import com.yihu.jw.hospital.module.door.dao.*;
|
|
|
import com.yihu.jw.hospital.task.PushMsgTask;
|
|
@ -19,6 +20,7 @@ import com.yihu.jw.hospital.utils.WeiXinAccessTokenUtils;
|
|
|
import com.yihu.jw.im.dao.ConsultDao;
|
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
|
import com.yihu.jw.order.dao.ConsultTeamOrderDao;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.service.BasePatientService;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
@ -129,6 +131,9 @@ public class DoorOrderService {
|
|
|
@Autowired
|
|
|
WeiXinAccessTokenUtils tokenUtils;
|
|
|
|
|
|
@Autowired
|
|
|
BasePatientDao basePatientDao;
|
|
|
|
|
|
// @Autowired
|
|
|
// private SignFamilyDao signFamilyDao;
|
|
|
// @Autowired
|
|
@ -663,10 +668,6 @@ public class DoorOrderService {
|
|
|
|
|
|
/**
|
|
|
* 拒单
|
|
|
*
|
|
|
* @param orderId
|
|
|
* @param reason
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void refuseOrder(String receiver, String orderId, String reason) throws Exception {
|
|
|
WlyyDoorServiceOrderDO doorServiceOrder = doorServiceOrderDao.findOne(orderId);
|
|
@ -678,16 +679,18 @@ public class DoorOrderService {
|
|
|
// this.createMessage(doorServiceOrder.getId(), "system", doorServiceOrder.getProxyPatient(), 403, "代预约服务工单重新派单", doorServiceOrder.getPatientName() + "的代预约服务工单需重新派单,请您前往处理");
|
|
|
//2021-12-29 代预约医生拒单直接取消
|
|
|
doorServiceOrder.setStatus(WlyyDoorServiceOrderDO.Status.cancel.getType());
|
|
|
doorServiceOrder.setCancelReason(reason); // 拒绝原因
|
|
|
doorServiceOrder.setCancelReason(reason);// 拒绝原因
|
|
|
doorServiceOrder.setCancelTime(new Date());
|
|
|
doorServiceOrderDao.save(doorServiceOrder);
|
|
|
} else {
|
|
|
//删除消息
|
|
|
this.systemMessageDao.orderMessageDel(doorServiceOrder.getDoctor(), orderId);
|
|
|
//有调度员
|
|
|
if (StringUtils.isNotBlank(doorServiceOrder.getDispatcher())) {
|
|
|
// 派单消息
|
|
|
this.createMessage(doorServiceOrder.getId(), "system", doorServiceOrder.getDispatcher(), 404, "服务工单拒单待重新派单", doorServiceOrder.getDoctorName() + "拒绝了" + doorServiceOrder.getProxyPatientName() + "的服务预约申请,请重新派单");
|
|
|
|
|
|
// 调度员-派单-实时工单消息:435 医生拒单-- 王五拒绝了服务工单12345678
|
|
|
// 调度员-派单-实时工单消息:435 医生拒单-- 王五拒绝了服务工单12345678
|
|
|
List<SystemMessageDO> messages = systemMessageDao.queryByRelationCodeAndTypeIn(orderId, new String[]{"431", "433"});
|
|
|
if (CollectionUtils.isEmpty(messages)) {
|
|
|
logger.error("当前工单没有医生待接单消息!orderId:" + orderId);
|
|
@ -713,11 +716,6 @@ public class DoorOrderService {
|
|
|
|
|
|
/**
|
|
|
* 添加【工单派单,转单】等系统消息
|
|
|
*
|
|
|
* @param orderId
|
|
|
* @param sender
|
|
|
* @param receiver
|
|
|
* @param Content
|
|
|
*/
|
|
|
public void createMessage(String orderId, String sender, String receiver, int type, String title, String Content) {
|
|
|
SystemMessageDO message = new SystemMessageDO();
|
|
@ -1353,28 +1351,29 @@ public class DoorOrderService {
|
|
|
// 获取微信模板 smfwdwk-上门服务待付款
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
try {
|
|
|
WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndScene("xm_test_ihealth_wx", "template_process_feedback", "fwyspf");
|
|
|
String first = templateConfig.getFirst();
|
|
|
first = first.replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
|
|
|
first = first.replace("key2", null != one.getDoctorName() ? one.getDoctorName() : "");
|
|
|
org.json.JSONObject json = new org.json.JSONObject();
|
|
|
json.put("first", first);
|
|
|
json.put("keyword1", DateUtil.dateToStrShort(new Date()));
|
|
|
json.put("keyword2", "服务医生评分");
|
|
|
json.put("url", templateConfig.getUrl());
|
|
|
json.put("remark", templateConfig.getRemark());
|
|
|
json.put("id", orderId);
|
|
|
//json.put("consult",consult.getCode());
|
|
|
WlyyDoorCommentDO wlyyDoorCommentDO = this.doorCommentDao.selectCommentDoctor(patient.getId(), orderId);
|
|
|
String finish = "";
|
|
|
if (wlyyDoorCommentDO != null) {
|
|
|
finish = "0";
|
|
|
json.put("finish", finish);
|
|
|
} else {
|
|
|
finish = "1";
|
|
|
json.put("finish", finish);
|
|
|
}
|
|
|
pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 31, patient.getOpenid(), patient.getName(), json);
|
|
|
// //暂时没有微信模板消息的功能
|
|
|
// WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndScene("xm_test_ihealth_wx", "template_process_feedback", "fwyspf");
|
|
|
// String first = templateConfig.getFirst();
|
|
|
// first = first.replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
|
|
|
// first = first.replace("key2", null != one.getDoctorName() ? one.getDoctorName() : "");
|
|
|
// org.json.JSONObject json = new org.json.JSONObject();
|
|
|
// json.put("first", first);
|
|
|
// json.put("keyword1", DateUtil.dateToStrShort(new Date()));
|
|
|
// json.put("keyword2", "服务医生评分");
|
|
|
// json.put("url", templateConfig.getUrl());
|
|
|
// json.put("remark", templateConfig.getRemark());
|
|
|
// json.put("id", orderId);
|
|
|
// //json.put("consult",consult.getCode());
|
|
|
// WlyyDoorCommentDO wlyyDoorCommentDO = this.doorCommentDao.selectCommentDoctor(patient.getId(), orderId);
|
|
|
// String finish = "";
|
|
|
// if (wlyyDoorCommentDO != null) {
|
|
|
// finish = "0";
|
|
|
// json.put("finish", finish);
|
|
|
// } else {
|
|
|
// finish = "1";
|
|
|
// json.put("finish", finish);
|
|
|
// }
|
|
|
// pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 31, patient.getOpenid(), patient.getName(), json);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
}
|
|
@ -1480,10 +1479,8 @@ public class DoorOrderService {
|
|
|
|
|
|
/**
|
|
|
* 修改预计到达时间
|
|
|
*
|
|
|
* @param orderId
|
|
|
* @param arrivingTime
|
|
|
* @return
|
|
|
* orderId
|
|
|
* arrivingTime
|
|
|
*/
|
|
|
public WlyyDoorServiceOrderDO updateArrivingTime(String orderId, String arrivingTime) {
|
|
|
WlyyDoorServiceOrderDO one = doorServiceOrderDao.findOne(orderId);
|
|
@ -1762,27 +1759,26 @@ public class DoorOrderService {
|
|
|
return typeValues;
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 修改保存服务项
|
|
|
// *
|
|
|
// * @param jsonData
|
|
|
// */
|
|
|
// @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
|
|
|
// public void updatePackageItemInfo(String jsonData) {
|
|
|
// JSONObject jsonObjectParam = JSONObject.parseObject(jsonData);
|
|
|
// String orderId = String.valueOf(jsonObjectParam.get("orderId"));
|
|
|
// WlyyDoorServiceOrderDO order = doorServiceOrderDao.findById(orderId);
|
|
|
// // 删除出诊医生或服务项
|
|
|
// wlyyDoorServiceOrderService.orderWithFeeDelete(jsonObjectParam, order);
|
|
|
// // 更新服务包信息
|
|
|
// wlyyDoorServiceOrderService.orderWithPackageItemFeeAdd(new JSONObject(), jsonObjectParam, order);
|
|
|
//
|
|
|
// // 发送微信模板消息,通知居民服务项目已经变更(smyyyjjd-服务项目变更通知)
|
|
|
// BasePatientDO patient = patientService.findByCode(order.getProxyPatient());
|
|
|
// ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
// Integer status = 0;
|
|
|
// try {
|
|
|
//
|
|
|
/**
|
|
|
* 修改保存服务项
|
|
|
*
|
|
|
* @param jsonData
|
|
|
*/
|
|
|
@org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class)
|
|
|
public void updatePackageItemInfo(String jsonData) throws Exception {
|
|
|
JSONObject jsonObjectParam = JSONObject.parseObject(jsonData);
|
|
|
String orderId = String.valueOf(jsonObjectParam.get("orderId"));
|
|
|
WlyyDoorServiceOrderDO order = doorServiceOrderDao.findOne(orderId);
|
|
|
// 删除出诊医生或服务项
|
|
|
wlyyDoorServiceOrderService.orderWithFeeDelete(jsonObjectParam, order);
|
|
|
// 更新服务包信息
|
|
|
wlyyDoorServiceOrderService.orderWithPackageItemFeeAdd(new JSONObject(), jsonObjectParam, order);
|
|
|
|
|
|
// 发送微信模板消息,通知居民服务项目已经变更(smyyyjjd-服务项目变更通知)
|
|
|
BasePatientDO patient = basePatientDao.findOne(order.getProxyPatient());
|
|
|
ConsultDo consult = consultDao.queryByRelationCode(orderId);
|
|
|
Integer status = 0;
|
|
|
try {
|
|
|
// WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_process_feedback", "fwxmbgtz");
|
|
|
// String first = templateConfig.getFirst();
|
|
|
// first = first.replace("key1", (patient.getName() == null ? "" : patient.getName()));
|
|
@ -1794,14 +1790,14 @@ public class DoorOrderService {
|
|
|
// json.put("keyword2", "服务项目变更确认");
|
|
|
// json.put("url", templateConfig.getUrl());
|
|
|
// json.put("remark", templateConfig.getRemark());
|
|
|
// json.put("consult", consult.getCode());
|
|
|
// json.put("consult", consult.getId());
|
|
|
// json.put("status", status);
|
|
|
//// pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 32, patient.getOpenid(), patient.getName(), json);
|
|
|
// } catch (Exception e) {
|
|
|
// logger.error(e.getMessage());
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
// pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 32, patient.getOpenid(), patient.getName(), json);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取管理员端上门服务菜单分类
|