|  | @ -2127,6 +2127,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 log.setStatus(rsCode);
 | 
	
		
			
				|  |  |                 log.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                 wlyyHttpLogDao.save(log);
 | 
	
		
			
				|  |  |                 if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |                     String type="";
 | 
	
		
			
				|  |  |                     if("1".equalsIgnoreCase(outpatientDO.getType())&&"1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                         type="9";
 | 
	
		
			
				|  |  |                     }else if("2".equalsIgnoreCase(outpatientDO.getType())&&"1".equalsIgnoreCase(outpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                         type="16";
 | 
	
		
			
				|  |  |                     }else if("1".equalsIgnoreCase(outpatientDO.getType())&&"3".equalsIgnoreCase(outpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                         type="1";
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     else if("2".equalsIgnoreCase(outpatientDO.getType())&&"3".equalsIgnoreCase(outpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                         type="17";
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     if (StringUtils.isNoneBlank(type)){
 | 
	
		
			
				|  |  |                         try {
 | 
	
		
			
				|  |  |                             sendWxTemplateMsg(wechatId, outpatientDO.getId(),null, type, "doctorRefund", "");
 | 
	
		
			
				|  |  |                             String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                             sendZsMsgFlow("OL_YSTZ",outpatientDO.getId(),"",msgUrl,"医生退诊");
 | 
	
		
			
				|  |  |                         }catch (Exception e){
 | 
	
		
			
				|  |  |                             e.printStackTrace();
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return  res;
 | 
	
	
		
			
				|  | @ -4144,7 +4168,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             wlyyOutpatientDO.setPatientCancelRemark(cancelRemark);
 | 
	
		
			
				|  |  |             wlyyOutpatientDO.setPatientCancelType(cancelType);
 | 
	
		
			
				|  |  |             wlyyOutpatientDO.setPatientCancelValue(cancelValue);
 | 
	
		
			
				|  |  |             String type="";
 | 
	
		
			
				|  |  |             if("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                 type="9";
 | 
	
		
			
				|  |  |             }else if("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                 type="16";
 | 
	
		
			
				|  |  |             }else if("1".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                 type="1";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else if("2".equalsIgnoreCase(wlyyOutpatientDO.getType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                 type="17";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             description = "居民取消";
 | 
	
		
			
				|  |  |             if (StringUtils.isNoneBlank(type)){
 | 
	
		
			
				|  |  |                 sendWxTemplateMsg(wxId, outPatientId,null, type, "patientCancel", "");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             //医生拒绝接诊
 | 
	
		
			
				|  |  |             wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
 | 
	
	
		
			
				|  | @ -4307,6 +4345,63 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             first = outpatientDO.getConsumerName() + ",您好!";
 | 
	
		
			
				|  |  |             logger.info("outPatientTimeOutRemind:outpatientId="+outpatientId+"contentMsg"+contentMsg);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         }else if("doctorPick".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您发起的图文复诊已被"+outpatientDO.getDoctorName()+"接诊,请留意医生发送的消息。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您发起的图文复诊,医生已接诊";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您发起的视频复诊已被"+outpatientDO.getDoctorName()+"接诊,请留意医生发送的消息。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您发起的视频复诊,医生已接诊";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您发起的图文咨询已被"+outpatientDO.getDoctorName()+"接诊,请留意医生发送的消息。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您发起的图文咨询,医生已接诊";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您发起的视频咨询已被"+outpatientDO.getDoctorName()+"接诊,请留意医生发送的消息。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您发起的视频咨询,医生已接诊";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("doctorPick诊查费支付成功推送模板消息:outpatientId="+outpatientId);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         } else if("doctorRefund".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您的图文复诊订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已退号";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您的视频复诊订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您发起的视频复诊已退号";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您的图文咨询订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您发起的图文咨询已退号";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您的视频咨询订单已退号。由于订单退号,诊察费将退回就诊卡内余额。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您发起的视频咨询已退号";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("doctorRefund:outpatientId="+outpatientId);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         } else if("patientCancel".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您发起的图文复诊已被您取消。由于订单取消将不做扣费处理。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已被您取消,您可重新发起";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您发起的视频复诊已被您取消。由于订单取消将不做扣费处理。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您的视频复诊已被您取消,您可重新发起";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您发起的图文咨询已被您取消。由于订单取消将不做扣费处理。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您的图文咨询已被您取消,您可重新发起";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您发起的视频咨询已被您取消。由于订单取消将不做扣费处理。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您的视频咨询已被您取消,您可重新发起";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("patientCancel诊查费支付成功推送模板消息:outpatientId="+outpatientId);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         }else if("systemCancelRemind".equalsIgnoreCase(titelType)){
 | 
	
		
			
				|  |  |             //超过24小时未接诊,系统取消
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
	
		
			
				|  | @ -4343,7 +4438,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 first =  outpatientDO.getConsumerName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
 | 
	
		
			
				|  |  |                 logger.info("视频咨询订单待支付微信消息模板推送开始");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |         } else if ("paySuccess".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您已成功发起图文复诊,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您已成功发起图文复诊";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您已成功发起视频复诊,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您已成功发起视频复诊";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg =  "您已成功发起图文咨询,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您已成功发起图文咨询";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您已成功发起视频咨询,请耐心等待医生接单。如长时间未接诊,建议选择其他医生";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您已成功发起视频咨询";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             logger.info("paySuccess诊查费支付成功推送模板消息:outpatientId="+outpatientId);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         }else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             //开具处方后向患者发送支付提醒
 | 
	
		
			
				|  |  |             first = outpatientDO.getConsumerName() + ",您好! 医生已为您开具处方,请及时支付。";
 | 
	
		
			
				|  |  |             contentMsg = "医生已为您开具处方,请及时支付。";
 | 
	
	
		
			
				|  | @ -4474,7 +4588,82 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 就诊支付提醒开始");
 | 
	
		
			
				|  |  |                 logger.info("极光消息推送 就诊支付提醒开始");
 | 
	
		
			
				|  |  |                 wxTempalteJPush("outpatient_pay",outpatientDO,null,"","","","");
 | 
	
		
			
				|  |  |             } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             } else if ("paySuccess".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //诊费支付成功提示
 | 
	
		
			
				|  |  |                 scene = "zfcgtx";
 | 
	
		
			
				|  |  |                 //就诊支付
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_success", scene, 1);
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                 newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
 | 
	
		
			
				|  |  |                 if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1( "图文复诊支付");
 | 
	
		
			
				|  |  |                     newConfig.setRemark(config.getRemark().replace("key2","图文复诊"));
 | 
	
		
			
				|  |  |                 } else if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
 | 
	
		
			
				|  |  |                     newConfig.setRemark(config.getRemark().replace("key2","视频复诊"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1( "视频复诊支付");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
 | 
	
		
			
				|  |  |                     newConfig.setRemark(config.getRemark().replace("key2","图文咨询"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1("图文咨询支付");
 | 
	
		
			
				|  |  |                 } else if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
 | 
	
		
			
				|  |  |                     newConfig.setRemark(config.getRemark().replace("key2","视频咨询"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1("视频咨询支付");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 newConfig.setKeyword2(outpatientDO.getHospitalName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3(outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |             } else if ("doctorPick".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //诊费支付成功提示
 | 
	
		
			
				|  |  |                 scene = "ysjzts";
 | 
	
		
			
				|  |  |                 //就诊支付
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_doctor_pick", scene, 1);
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                 newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
 | 
	
		
			
				|  |  |                 if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1( "图文复诊接诊");
 | 
	
		
			
				|  |  |                 } else if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1( "视频复诊接诊");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1("图文咨询接诊");
 | 
	
		
			
				|  |  |                 } else if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1("视频咨询接诊");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 newConfig.setRemark(config.getRemark().replace("key1",outpatientDO.getDoctorName()));
 | 
	
		
			
				|  |  |                 newConfig.setKeyword2(outpatientDO.getHospitalName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3(outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |             }else if ("patientCancel".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 scene = "hzqxfz";
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_patient_cancel", scene, 1);
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                 newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
 | 
	
		
			
				|  |  |                 if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "图文复诊"));
 | 
	
		
			
				|  |  |                 } else if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊"));
 | 
	
		
			
				|  |  |                 }else if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询"));
 | 
	
		
			
				|  |  |                 } else if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询"));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 newConfig.setKeyword1( outpatientDO.getHospitalName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword2(outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3(outpatientDO.getFee()==null?"0":outpatientDO.getFee().toString());
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送");
 | 
	
		
			
				|  |  |             }else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //处方开具支付提醒
 | 
	
		
			
				|  |  |                 scene = "cfzfts";
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_prescription_pay_notice", scene, 1);
 | 
	
	
		
			
				|  | @ -5657,27 +5846,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 e.put("workTotal",0);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         });
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         list.stream().sorted(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("workTotal"))).reversed().thenComparing(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("consultStatus")))).reversed());*/
 | 
	
		
			
				|  |  |         String hospital="";
 | 
	
		
			
				|  |  |         for (Map<String,Object> map:list){
 | 
	
		
			
				|  |  |             String doctor = map.get("id").toString();
 | 
	
		
			
				|  |  |             //号别
 | 
	
		
			
				|  |  |             String deptTyepCode = "";
 | 
	
		
			
				|  |  |             if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |                 deptTyepCode = "6";
 | 
	
		
			
				|  |  |                 List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor);
 | 
	
		
			
				|  |  |                 if (null!=depts&&depts.size()>0){
 | 
	
		
			
				|  |  |                     BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0);
 | 
	
		
			
				|  |  |                     String deptcode =  baseDoctorHospitalDO.getDeptCode();
 | 
	
		
			
				|  |  |                     String hosptitalCode = baseDoctorHospitalDO.getOrgCode();
 | 
	
		
			
				|  |  |                     List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode);
 | 
	
		
			
				|  |  |                     if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){
 | 
	
		
			
				|  |  |                         if (StringUtils.isNotBlank(dictHospitalDeptDO.get(0).getDeptTypeCode())){
 | 
	
		
			
				|  |  |                             deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode();
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |             List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor);
 | 
	
		
			
				|  |  |             if (null!=depts&&depts.size()>0){
 | 
	
		
			
				|  |  |                 BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0);
 | 
	
		
			
				|  |  |                 hospital = baseDoctorHospitalDO.getOrgCode();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             /*List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
 | 
	
		
			
				|  |  |             if(null!=map.get("chargeType")){
 | 
	
		
			
				|  |  |                 String chargeType = map.get("chargeType").toString();
 | 
	
	
		
			
				|  | @ -5740,7 +5921,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
 | 
	
		
			
				|  |  |             count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<WlyyHospitalSysDictDO> doctorFrontList = wlyyHospitalSysDictDao.findByDictNameOrderBySort("doctorFrontList");
 | 
	
		
			
				|  |  |         List<WlyyHospitalSysDictDO> doctorFrontList = wlyyHospitalSysDictDao.findByDictNameOrderBySort("doctorFrontList",hospital);
 | 
	
		
			
				|  |  |         if (doctorFrontList!=null&&doctorFrontList.size()>0){
 | 
	
		
			
				|  |  |             List<Map<String,Object>> frontDoctor = new ArrayList<>();
 | 
	
		
			
				|  |  |             if (list!=null&&list.size()>0){
 | 
	
	
		
			
				|  | @ -8392,6 +8573,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                             free = res.getString("@total_charge");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1","WX_PUB");
 | 
	
		
			
				|  |  |                         if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |                             String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientDO.getId()+"&id="+prescriptionId;
 | 
	
		
			
				|  |  |                             sendZsMsgFlow("OL_JSTX",outpatientDO.getId(),prescriptionId,msgUrl,"结算提醒");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         throw new Exception(map.get("mes").toString());
 | 
	
		
			
				|  |  |                     }
 | 
	
	
		
			
				|  | @ -11623,6 +11808,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public String wxTempalteJPush(String templateCode,WlyyOutpatientDO wlyyOutpatientDO ,ConsultTeamDo consultTeamDo,String drugName ,String mailNo,String mailStatus,String prescriptionId){
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |         String userId = "";
 | 
	
		
			
				|  |  |         String content = "";
 | 
	
		
			
				|  |  |         String title="";
 | 
	
	
		
			
				|  | @ -11817,5 +12003,144 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return jPushMessage(isDoctor,userId,content,title,jsonObject);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return "";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //中山消息中心业务接口
 | 
	
		
			
				|  |  |     public String sendZsMsgFlow(String msgType ,String outpatientId,String prescriptionId,String jumpUrl,String remark){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             String visitId ="";//挂号流水号
 | 
	
		
			
				|  |  |             String msgId ="";//挂号流水号
 | 
	
		
			
				|  |  |             String idType ="01";//证件类型 01:身份证 * 02:户口簿* 03:护照* 04:军官证* 05:驾驶证* 06:港澳居民往来内地通行证* 07:台湾居民往来内地通行证* 99:其他法定有效证件
 | 
	
		
			
				|  |  |             String idNo ="";//证件号
 | 
	
		
			
				|  |  |             String patientName ="";//患者姓名
 | 
	
		
			
				|  |  |             String msgTime ="";//消息时间yyyy-MM-dd HH:mm:sss
 | 
	
		
			
				|  |  |             String msgContent ="";//消息内容
 | 
	
		
			
				|  |  |             String jumpType ="1";
 | 
	
		
			
				|  |  |             String miniAppId ="";
 | 
	
		
			
				|  |  |             String miniAppUrl ="";
 | 
	
		
			
				|  |  |             String sender ="";//发送系统
 | 
	
		
			
				|  |  |             SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |             if ("OL_PAY_SUCCESS".equalsIgnoreCase(msgType)){//在线问诊-已支付问诊费
 | 
	
		
			
				|  |  |                 WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |                 BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientId);
 | 
	
		
			
				|  |  |                 if(businessOrderDO!=null){
 | 
	
		
			
				|  |  |                     msgId=businessOrderDO.getOrderNo().substring(5);
 | 
	
		
			
				|  |  |                     visitId = businessOrderDO.getOrderNo().substring(5);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (wlyyOutpatientDO!=null){
 | 
	
		
			
				|  |  |                     idNo=wlyyOutpatientDO.getIdcard();
 | 
	
		
			
				|  |  |                     patientName = wlyyOutpatientDO.getPatientName();
 | 
	
		
			
				|  |  |                     msgTime = sf.format(new Date());
 | 
	
		
			
				|  |  |                     sender ="ZJXL";
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |                     DoctorMappingDO doctorMappingDO =doctorMappingDao.findByDoctor(wlyyOutpatientDO.getDoctor());
 | 
	
		
			
				|  |  |                     if(doctorMappingDO!=null){
 | 
	
		
			
				|  |  |                         jsonObject.put("doctorId",doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",patientName);
 | 
	
		
			
				|  |  |                     jsonObject.put("idType",idType);
 | 
	
		
			
				|  |  |                     jsonObject.put("idNo",idNo);
 | 
	
		
			
				|  |  |                     jsonObject.put("doctorName",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     jsonObject.put("deptId",wlyyOutpatientDO.getDept());
 | 
	
		
			
				|  |  |                     jsonObject.put("deptName",wlyyOutpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                     jsonObject.put("visitTime",sf.format(wlyyOutpatientDO.getCreateTime()));
 | 
	
		
			
				|  |  |                     msgContent= jsonObject.toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }else if ("OL_WZ_CANCEL".equalsIgnoreCase(msgType)||"OL_WZCS_CANCEL".equalsIgnoreCase(msgType)){
 | 
	
		
			
				|  |  |                 WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |                 BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientId);
 | 
	
		
			
				|  |  |                 if(businessOrderDO!=null){
 | 
	
		
			
				|  |  |                     msgId=businessOrderDO.getOrderNo().substring(5);
 | 
	
		
			
				|  |  |                     visitId = businessOrderDO.getOrderNo().substring(5);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (wlyyOutpatientDO!=null){
 | 
	
		
			
				|  |  |                     idNo=wlyyOutpatientDO.getIdcard();
 | 
	
		
			
				|  |  |                     patientName = wlyyOutpatientDO.getPatientName();
 | 
	
		
			
				|  |  |                     msgTime = sf.format(new Date());
 | 
	
		
			
				|  |  |                     sender ="ZJXL";
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",patientName);
 | 
	
		
			
				|  |  |                     jsonObject.put("idType",idType);
 | 
	
		
			
				|  |  |                     jsonObject.put("idNo",idNo);
 | 
	
		
			
				|  |  |                     jsonObject.put("doctorName",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     jsonObject.put("deptName",wlyyOutpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                     jsonObject.put("visitTime",sf.format(wlyyOutpatientDO.getCreateTime()));
 | 
	
		
			
				|  |  |                     msgContent= jsonObject.toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }else if ("OL_WZ_START".equalsIgnoreCase(msgType)||"OL_WZ_END".equalsIgnoreCase(msgType)||"OL_YSTZ".equalsIgnoreCase(msgType)||"OL_JSTX".equalsIgnoreCase(msgType)){
 | 
	
		
			
				|  |  |                 WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |                 if (wlyyOutpatientDO!=null){
 | 
	
		
			
				|  |  |                     visitId = wlyyOutpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |                     if (StringUtils.isNoneBlank(prescriptionId)){
 | 
	
		
			
				|  |  |                         WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
 | 
	
		
			
				|  |  |                         if(wlyyPrescriptionDO!=null){
 | 
	
		
			
				|  |  |                             msgId=wlyyPrescriptionDO.getVoucherNo();
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         msgId = wlyyOutpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     idNo=wlyyOutpatientDO.getIdcard();
 | 
	
		
			
				|  |  |                     patientName = wlyyOutpatientDO.getPatientName();
 | 
	
		
			
				|  |  |                     msgTime = sf.format(new Date());
 | 
	
		
			
				|  |  |                     sender ="ZJXL";
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",patientName);
 | 
	
		
			
				|  |  |                     jsonObject.put("idType",idType);
 | 
	
		
			
				|  |  |                     jsonObject.put("idNo",idNo);
 | 
	
		
			
				|  |  |                     jsonObject.put("doctorName",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     jsonObject.put("deptName",wlyyOutpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                     jsonObject.put("visitTime",sf.format(wlyyOutpatientDO.getCreateTime()));
 | 
	
		
			
				|  |  |                     msgContent= jsonObject.toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else if ("OL_JS_SUCCESS".equalsIgnoreCase(msgType)){
 | 
	
		
			
				|  |  |                 WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |                 if (wlyyOutpatientDO!=null){
 | 
	
		
			
				|  |  |                     visitId = wlyyOutpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |                     if (StringUtils.isNoneBlank(prescriptionId)){
 | 
	
		
			
				|  |  |                         WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
 | 
	
		
			
				|  |  |                         if(wlyyPrescriptionDO!=null){
 | 
	
		
			
				|  |  |                             msgId=wlyyPrescriptionDO.getVoucherNo();
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         msgId = wlyyOutpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     idNo=wlyyOutpatientDO.getIdcard();
 | 
	
		
			
				|  |  |                     patientName = wlyyOutpatientDO.getPatientName();
 | 
	
		
			
				|  |  |                     msgTime = sf.format(new Date());
 | 
	
		
			
				|  |  |                     sender ="ZJXL";
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",patientName);
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionInfoDO> list=prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     String drugName="";
 | 
	
		
			
				|  |  |                     if (list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |                         for (int i=0;i<list.size();i++){
 | 
	
		
			
				|  |  |                             if(i==0){
 | 
	
		
			
				|  |  |                                 drugName = list.get(0).getDrugName();
 | 
	
		
			
				|  |  |                             }else {
 | 
	
		
			
				|  |  |                                 drugName+=","+list.get(i).getDrugName();
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     jsonObject.put("drugsName",drugName);
 | 
	
		
			
				|  |  |                     msgContent= jsonObject.toString();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             return entranceService.zsMsgFlow(visitId,msgId,idType,idNo,patientName,msgTime,msgType,msgContent,jumpType,jumpUrl,"","",remark,sender);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |             return null;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |