|  | @ -13,7 +13,9 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.door.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.message.dao.SystemMessageDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.dao.ConsultTeamDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.util.ImUtil;
 | 
	
	
		
			
				|  | @ -127,6 +129,10 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |     private WlyyDoorCommentDao doorCommentDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private SystemMessageDao systemMessageDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionDao prescriptionDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 顶部状态栏订单各分类总条数
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
	
		
			
				|  | @ -342,8 +348,8 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |         doorServiceOrder.setDoorConclusion(doorConclusion);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //获取上门前后开方详情
 | 
	
		
			
				|  |  |         List<WlyyDoorPrescriptionDO> doorBeforePrescriptionDOList = doorPrescriptionDao.findByOrderIdAndIsAfterDoor(id, 1);
 | 
	
		
			
				|  |  |         List<WlyyDoorPrescriptionDO> doorAfterPrescriptionDOList = doorPrescriptionDao.findByOrderIdAndIsAfterDoor(id, 2);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionDO> doorBeforePrescriptionDOList = prescriptionDao.findByOrderIdAndIsAfterDoor(id, 1);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionDO> doorAfterPrescriptionDOList = prescriptionDao.findByOrderIdAndIsAfterDoor(id, 2);
 | 
	
		
			
				|  |  |         doorServiceOrder.setPrescriptionDOList(doorBeforePrescriptionDOList);
 | 
	
		
			
				|  |  |         doorServiceOrder.setAfterPrescriptionList(doorAfterPrescriptionDOList);
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -528,17 +534,14 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |         // 获取微信模板
 | 
	
		
			
				|  |  |         ConsultDo consult = consultDao.queryByRelationCode(orderId);
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String patientName=patient.getName()==null?"":patient.getName();
 | 
	
		
			
				|  |  |             String doctorName=doorServiceOrder.getDoctorName()!=null? doorServiceOrder.getDoctorName() : "";
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |             if(consult != null) {
 | 
	
		
			
				|  |  |                 String consultStr =  consult.getId();
 | 
	
		
			
				|  |  |                 json.put("consult", consult.getId());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String first = patientName+",您好!您的上门预约服务已由【"+doctorName+"】医生接单了";
 | 
	
		
			
				|  |  |             logger.info("上门服务已接单推送前");
 | 
	
		
			
				|  |  |             //url + json.getString("url") + "?openid=" + openid + "&consult=" + json.getString("consult")
 | 
	
		
			
				|  |  |             messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyjjd",patient.getOpenid(),first,null,null,DateUtil.dateToStrShort(new Date()),"上门服务已接单");
 | 
	
		
			
				|  |  |             logger.info("上门服务已接单推送前");
 | 
	
		
			
				|  |  |             String first = "key1,您好!您的上门预约服务已由【key2】医生接单了";
 | 
	
		
			
				|  |  |             first = first.replace("key1",(patient.getName()==null?"":patient.getName()));
 | 
	
		
			
				|  |  |             first = first.replace("key2", null != doorServiceOrder.getDoctorName() ? doorServiceOrder.getDoctorName() : "");
 | 
	
		
			
				|  |  |             messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyjjd",patient.getOpenid(),first,null,null,30,json,DateUtil.dateToStrShort(new Date()),"上门服务已接单");
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -964,34 +967,10 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |         // 获取微信模板 smfwdwk-上门服务待付款
 | 
	
		
			
				|  |  |         ConsultDo consult = consultDao.queryByRelationCode(orderId);
 | 
	
		
			
				|  |  |         try {//·
 | 
	
		
			
				|  |  |             String first = "key1预约上门服务医生已完成服务。为提高服务质量,诚邀您对本次服务医生进行评分";
 | 
	
		
			
				|  |  |             first = first.replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
 | 
	
		
			
				|  |  |             first = first .replace("key2", null != one.getDoctorName() ? one.getDoctorName() : "");
 | 
	
		
			
				|  |  |             WlyyDoorCommentDO wlyyDoorCommentDO = doorCommentDao.selectCommentDoctor(patient.getId(),orderId);
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |             String finish="";
 | 
	
		
			
				|  |  |             if(wlyyDoorCommentDO!=null){
 | 
	
		
			
				|  |  |                 finish = "0";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 finish = "1";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //url:url + json.getString("url")+"?openid=" + openid + "&id=" + json.getString("id")+ "&finish=" + finish)
 | 
	
		
			
				|  |  |             messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",patient.getOpenid(),first,null,null,DateUtil.dateToStrShort(new Date()),"服务医生评分");
 | 
	
		
			
				|  |  | /*            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("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.getCode(),orderId);
 | 
	
		
			
				|  |  |             String finish="";
 | 
	
		
			
				|  |  |             if(wlyyDoorCommentDO!=null){
 | 
	
		
			
				|  |  |                 finish = "0";
 | 
	
		
			
				|  |  |                 json.put("finish",finish);
 | 
	
	
		
			
				|  | @ -999,7 +978,9 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |                 finish = "1";
 | 
	
		
			
				|  |  |                 json.put("finish",finish);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 31, patient.getOpenid(), patient.getName(), json);*/
 | 
	
		
			
				|  |  |             String first="key1预约上门服务医生已完成服务。为提高服务质量,诚邀您对本次服务医生进行评分".replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
 | 
	
		
			
				|  |  |             messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",patient.getOpenid(),first,null,null,31,json,DateUtil.dateToStrShort(new Date()),"服务医生评分");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -1045,40 +1026,10 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |         // 获取微信模板  fwyspf-服务医生评分
 | 
	
		
			
				|  |  |         ConsultDo consult = consultDao.queryByRelationCode(orderId);
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             String first = "key1预约上门服务医生已完成服务。为提高服务质量,诚邀您对本次服务医生进行评分";
 | 
	
		
			
				|  |  |             first = first.replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
 | 
	
		
			
				|  |  |             first = first .replace("key2", null != one.getDoctorName() ? one.getDoctorName() : "");
 | 
	
		
			
				|  |  |             WlyyDoorCommentDO wlyyDoorCommentDO = doorCommentDao.selectCommentDoctor(patient.getId(),orderId);
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |             String finish="";
 | 
	
		
			
				|  |  |             if(wlyyDoorCommentDO!=null){
 | 
	
		
			
				|  |  |                 finish = "0";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 finish = "1";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //url:url + json.getString("url")+"?openid=" + openid + "&id=" + json.getString("id")+ "&finish=" + finish)
 | 
	
		
			
				|  |  |             messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",patient.getOpenid(),first,null,null,DateUtil.dateToStrShort(new Date()),"服务医生评分");
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error(e.getMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /*        try {
 | 
	
		
			
				|  |  |          WechatTemplateConfig templateConfig = templateConfigDao.findByScene("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() : "");
 | 
	
		
			
				|  |  |             String keyword1 = templateConfig.getKeyword1();
 | 
	
		
			
				|  |  |             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.getCode(),orderId);
 | 
	
		
			
				|  |  |             String finish="";
 | 
	
		
			
				|  |  |             if(wlyyDoorCommentDO!=null){
 | 
	
		
			
				|  |  |                 finish = "0";
 | 
	
		
			
				|  |  |                 json.put("finish",finish);
 | 
	
	
		
			
				|  | @ -1086,10 +1037,11 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |                 finish = "1";
 | 
	
		
			
				|  |  |                 json.put("finish",finish);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 31, patient.getOpenid(), patient.getName(), json);
 | 
	
		
			
				|  |  |             String first="key1预约上门服务医生已完成服务。为提高服务质量,诚邀您对本次服务医生进行评分".replace("key1", DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm"));
 | 
	
		
			
				|  |  |             messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",patient.getOpenid(),first,null,null,31,json,DateUtil.dateToStrShort(new Date()),"服务医生评分");
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error(e.getMessage());
 | 
	
		
			
				|  |  |         }*/
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return this.getDoorServiceOrderById(orderId, level);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1347,26 +1299,11 @@ public class DoorOrderService {
 | 
	
		
			
				|  |  |         ConsultDo consult = consultDao.queryByRelationCode(orderId);
 | 
	
		
			
				|  |  |         Integer status = 0;
 | 
	
		
			
				|  |  |         try{
 | 
	
		
			
				|  |  |             String first = "您的预约服务的服务项目已变更,请及时确认";
 | 
	
		
			
				|  |  |             first = first.replace("key1",(patient.getName()==null?"":patient.getName()));
 | 
	
		
			
				|  |  |             first = first .replace("key2", null != order.getDoctorName() ? order.getDoctorName() : "");
 | 
	
		
			
				|  |  |             String consultStr = consult.getId();
 | 
	
		
			
				|  |  | //            url1 + json.getString("url")+"?openid=" + openid + "&consult=" + json.getString("consult") + "&status=" + json.getInt("status")
 | 
	
		
			
				|  |  | //            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwyspf",patient.getOpenid(),first,null,null,DateUtil.dateToStrShort(new Date()),"服务项目变更确认");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             /* WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_process_feedback","fwxmbgtz");
 | 
	
		
			
				|  |  |             String first = templateConfig.getFirst();
 | 
	
		
			
				|  |  |             first = first.replace("key1",(patient.getName()==null?"":patient.getName()));
 | 
	
		
			
				|  |  |             first = first .replace("key2", null != order.getDoctorName() ? order.getDoctorName() : "");
 | 
	
		
			
				|  |  |             String keyword1 = templateConfig.getKeyword1();
 | 
	
		
			
				|  |  |             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("consult",consult.getCode());
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |             json.put("consult",consult.getId());
 | 
	
		
			
				|  |  |             json.put("status",status);
 | 
	
		
			
				|  |  |            //messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","fwxmbgtz",patient.getOpenid(),null,null,null,32,json);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //            pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 32, patient.getOpenid(), patient.getName(), json);*/
 | 
	
		
			
				|  |  |         }catch (Exception e) {
 |