|  | @ -643,6 +643,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                             vo.setWlyyPrescriptionEmrDO(listEmr.get(0));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
 | 
	
		
			
				|  |  |                     if (wlyyPrescriptionEmrDO1 != null) {
 | 
	
		
			
				|  |  |                         vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //支付信息
 | 
	
		
			
				|  |  |                 BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
 | 
	
	
		
			
				|  | @ -663,15 +668,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             rs.put("expressage", null);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (!wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
 | 
	
		
			
				|  |  |             //物流配送新
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
 | 
	
		
			
				|  |  |             if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
 | 
	
		
			
				|  |  |                 rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 rs.put("expressageLogs", null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         //物流配送新
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
 | 
	
		
			
				|  |  |         if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
 | 
	
		
			
				|  |  |             rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             rs.put("expressageLogs", null);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //预约记录
 | 
	
	
		
			
				|  | @ -2423,7 +2426,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             prescriptionDO.setType(1);
 | 
	
		
			
				|  |  |             prescriptionDO.setDept(outpatientDO.getDept());
 | 
	
		
			
				|  |  |             prescriptionDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             prescriptionDO.setDeptName(outpatientDO.getDeptName());
 | 
	
		
			
				|  |  |             prescriptionDO.setHospital(outpatientDO.getHospital());
 | 
	
		
			
				|  |  |             prescriptionDO.setHospitalName(outpatientDO.getHospitalName());
 | 
	
		
			
				|  |  |             prescriptionDO.setStatus(10);
 | 
	
		
			
				|  |  |             prescriptionDO.setIdcard(outpatientDO.getIdcard());
 | 
	
		
			
				|  |  |             prescriptionDO.setPatientCode(outpatientDO.getPatient());
 | 
	
		
			
				|  |  |             prescriptionDO.setPatientName(outpatientDO.getPatientName());
 | 
	
		
			
				|  |  |             prescriptionDO.setDoctor(outpatientDO.getDoctor());
 | 
	
	
		
			
				|  | @ -2619,6 +2626,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 result1.put("mes", "开方提交成功");
 | 
	
		
			
				|  |  |                 result1.put("prescriptionId",prescription.getId());
 | 
	
		
			
				|  |  |                 return result1;
 | 
	
		
			
				|  |  |             }else if (wechatId.equalsIgnoreCase("sd_tnzyy_wx")) {
 | 
	
		
			
				|  |  |                 Double price = prescription.getDrugFee();
 | 
	
		
			
				|  |  |                 businessOrderService.recharge(prescription.getId(), "处方收费", "4", "处方收费", prescription.getPatientCode(), prescription.getPatientName(), prescription.getDoctor(), price);
 | 
	
		
			
				|  |  |                 result.put("code", 1);
 | 
	
		
			
				|  |  |                 result.put("mes", "诊断完成");
 | 
	
		
			
				|  |  |                 result.put("prescriptionId",prescription.getId());
 | 
	
		
			
				|  |  |                 return result;
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 result.put("code", 1);
 | 
	
		
			
				|  |  |                 result.put("mes", "诊断完成");
 | 
	
	
		
			
				|  | @ -3022,13 +3036,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         String sql = "SELECT  ";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |                 sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"expressCreateTime\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"expressCreateTime\",";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 sql = sql + "date_format(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |                 sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
 | 
	
		
			
				|  |  |             sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
	
		
			
				|  | @ -4170,6 +4194,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         String first = "";
 | 
	
		
			
				|  |  |         String remark = "";
 | 
	
		
			
				|  |  |         if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             //医生拒绝接诊
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg;
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您的图文复诊已取消";
 | 
	
	
		
			
				|  | @ -4189,11 +4214,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         } else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             //医生未接诊时患者等待时间过长的模板提示
 | 
	
		
			
				|  |  |             contentMsg = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
 | 
	
		
			
				|  |  |             first = outpatientDO.getConsumerName() + ",您好!";
 | 
	
		
			
				|  |  |             logger.info("outPatientTimeOutRemind:outpatientId="+outpatientId+"contentMsg"+contentMsg);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         }else if("systemCancelRemind".equalsIgnoreCase(titelType)){
 | 
	
		
			
				|  |  |             //超过24小时未接诊,系统取消
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "图文咨询因超时自动取消。您可重新发起。由于订单取消将不做扣费处理。";
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您的图文复诊因超时未接诊已取消";
 | 
	
	
		
			
				|  | @ -4205,7 +4232,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             logger.info("系统取消接诊入参:outpatientId="+outpatientId);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |         } else if ("payRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //患者发起时提醒患者支付诊费消息
 | 
	
		
			
				|  |  |             if ("9".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "请您先完成预交金充值发起在线问诊,点击详情进行预交金充值,如您已完成请忽略本条信息。";//您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您有一笔未完成的在线问诊订单,请及时处理。";//您有一个图文复诊订单待支付,请及时支付。
 | 
	
	
		
			
				|  | @ -4219,68 +4246,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if ("1".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(outpatientId)){
 | 
	
		
			
				|  |  |                     msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                     first = outpatientDO.getConsumerName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
 | 
	
		
			
				|  |  |                     first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                 first = outpatientDO.getConsumerName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
 | 
	
		
			
				|  |  |                 logger.info("图文咨询订单待支付微信消息模板推送开始");
 | 
	
		
			
				|  |  |             } else if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                 contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(outpatientId)){
 | 
	
		
			
				|  |  |                     msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                     first =  outpatientDO.getConsumerName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult();
 | 
	
		
			
				|  |  |                     first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                 first =  outpatientDO.getConsumerName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
 | 
	
		
			
				|  |  |                 logger.info("视频咨询订单待支付微信消息模板推送开始");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             //开具处方后向患者发送支付提醒
 | 
	
		
			
				|  |  |             first = outpatientDO.getConsumerName() + ",您好! 医生已为您开具处方,请及时支付。";
 | 
	
		
			
				|  |  |             contentMsg = "医生已为您开具处方,请及时支付。";
 | 
	
		
			
				|  |  |             remark = "点击完成支付,如您已支付请忽略本条信息";
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+remindMsg;
 | 
	
		
			
				|  |  |             logger.info("处方支付微信消息模板推送开始");
 | 
	
		
			
				|  |  |         } else if ("msgRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             first = outpatientDO.getConsumerName() + ",您好!";
 | 
	
		
			
				|  |  |             contentMsg = "" + remindMsg;
 | 
	
		
			
				|  |  |             remark = "请您尽快回复";
 | 
	
		
			
				|  |  |         } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |               if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                   first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
 | 
	
		
			
				|  |  |                   contentMsg = "您的视频复诊已开始,错过将重新排队";
 | 
	
		
			
				|  |  |                   remark = "点击消息进入视频诊室接听视频通话,开始视频咨询。";
 | 
	
		
			
				|  |  |                   msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                   logger.info("视频问诊已接诊提醒微信模板消息发送开始");
 | 
	
		
			
				|  |  |               }
 | 
	
		
			
				|  |  |               if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                   first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
 | 
	
		
			
				|  |  |                   contentMsg = "您的视频咨询已开始,错过将重新排队";
 | 
	
		
			
				|  |  |                   remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
 | 
	
		
			
				|  |  |                   if (StringUtils.isNotEmpty(outpatientId)){
 | 
	
		
			
				|  |  |                       msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=17&outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                   }else{
 | 
	
		
			
				|  |  |                       msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
 | 
	
		
			
				|  |  |                   }
 | 
	
		
			
				|  |  |                   logger.info("视频咨询已接诊提醒微信模板消息发送开始");
 | 
	
		
			
				|  |  |               }
 | 
	
		
			
				|  |  |           /*if (consultTeam!=null){
 | 
	
		
			
				|  |  |               if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                   first = consDoctorDO.getName() + consDoctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
 | 
	
		
			
				|  |  |                   contentMsg = "您的视频咨询已开始,错过将重新排队";
 | 
	
		
			
				|  |  |                   remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
 | 
	
		
			
				|  |  |                   msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult();
 | 
	
		
			
				|  |  |                   logger.info("视频咨询已接诊提醒微信模板消息发送开始");
 | 
	
		
			
				|  |  |               }
 | 
	
		
			
				|  |  |           }*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //视频复诊预约提醒
 | 
	
		
			
				|  |  |             if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                 msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId;
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(outpatientDO.getDoctorName())){
 | 
	
	
		
			
				|  | @ -4312,6 +4295,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
 | 
	
		
			
				|  |  |         } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |             //服务评价提醒
 | 
	
		
			
				|  |  |             if (consultTeam.getType()!=null&&1==consultTeam.getType()){
 | 
	
		
			
				|  |  |                 first = consultTeam.getName() + ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
 | 
	
		
			
				|  |  |                 logger.info("图文咨询服务评价微信消息模板推送开始");
 | 
	
	
		
			
				|  | @ -4331,9 +4315,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/fuwupingjia?consultCode="+consultTeam.getConsult();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equalsIgnoreCase(wxId)||"sd_tnzyy_wx".equalsIgnoreCase(wxId)) {
 | 
	
		
			
				|  |  |             List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
 | 
	
		
			
				|  |  |             if (StringUtils.isNotEmpty(outpatientId)){
 | 
	
		
			
				|  |  |                 ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getConsumer());
 | 
	
	
		
			
				|  | @ -4349,6 +4331,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             String scene = "";
 | 
	
		
			
				|  |  |             WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
 | 
	
		
			
				|  |  |             if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //医生拒绝接诊
 | 
	
		
			
				|  |  |                 scene = "ysqxjz";
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_doctor_notice", scene, 1);
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
	
		
			
				|  | @ -4372,55 +4355,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("就诊等待过长提示");
 | 
	
		
			
				|  |  |             } else if ("payRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //诊费支付提示
 | 
	
		
			
				|  |  |                 scene = "zxzfts";
 | 
	
		
			
				|  |  |                 //就诊支付
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotEmpty(outpatientId)){
 | 
	
		
			
				|  |  |                     WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_jz", 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.setKeyword2(outpatientDO.getHospitalName());
 | 
	
		
			
				|  |  |                     newConfig.setKeyword3(outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     //发起微信消息模板推送
 | 
	
		
			
				|  |  |                     newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                     logger.info("眼科微信消息模板推送 就诊支付提醒开始");
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     //咨询支付
 | 
	
		
			
				|  |  |                     if (consultTeam!=null){
 | 
	
		
			
				|  |  |                         WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1);
 | 
	
		
			
				|  |  |                         BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                         newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()));
 | 
	
		
			
				|  |  |                         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.setKeyword2( hospitalDO.getOrgName());
 | 
	
		
			
				|  |  |                         newConfig.setKeyword3( consDoctorDO.getName());
 | 
	
		
			
				|  |  |                         //发起微信消息模板推送
 | 
	
		
			
				|  |  |                         newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
 | 
	
		
			
				|  |  |                         logger.info("眼科微信消息模板推送 咨询支付提醒开始");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_jz", 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.setKeyword2(outpatientDO.getHospitalName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3(outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 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);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                 newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
 | 
	
		
			
				|  |  |                 newConfig.setKeyword1( "处方支付");
 | 
	
	
		
			
				|  | @ -4429,105 +4392,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 处方支付提醒开始");
 | 
	
		
			
				|  |  |             } else if ("msgRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 scene = "zxxxtx";
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_msg_notice", scene, 1);
 | 
	
		
			
				|  |  |             }else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //视频问诊预约提醒
 | 
	
		
			
				|  |  |                 scene = "spwzyytx";
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                 newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getConsumerName()));
 | 
	
		
			
				|  |  |                 newConfig.setKeyword1( remindMsg);
 | 
	
		
			
				|  |  |                 newConfig.setKeyword2( DateUtil.getStringDate());
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |             } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 scene = "mzxxtx";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotEmpty(outpatientId)){
 | 
	
		
			
				|  |  |                     WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_jz", scene, 1);
 | 
	
		
			
				|  |  |                     BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getDoctorName()).replace("key2", StringUtils.isNoneBlank(doctorDO.getJobTitleName())?doctorDO.getJobTitleName():""));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1( outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     newConfig.setKeyword2(DateUtil.dateToStrLong(outpatientDO.getAdmDate()));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword3(outpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                     newConfig.setKeyword4( outpatientDO.getIcd10Name());
 | 
	
		
			
				|  |  |                     if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                         newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
 | 
	
		
			
				|  |  |                         newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                     } else if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                         newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
 | 
	
		
			
				|  |  |                         newConfig.setUrl(newConfig.getUrl().replace("type=16","type=17") + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     //发起微信消息模板推送
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     logger.info("眼科微信消息模板推送 视频问诊接诊提醒开始");
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     if (consultTeam!=null){
 | 
	
		
			
				|  |  |                         WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_zx", scene, 1);
 | 
	
		
			
				|  |  |                         BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()).replace("key2", consDoctorDO.getJobTitleName()));
 | 
	
		
			
				|  |  |                         newConfig.setKeyword1( consDoctorDO.getName());
 | 
	
		
			
				|  |  |                         newConfig.setKeyword2(DateUtil.dateToStrLong(consultTeam.getCzrq()));//咨询暂无挂号时间
 | 
	
		
			
				|  |  |                         newConfig.setKeyword3( hospitalDO.getDeptName());
 | 
	
		
			
				|  |  |                         newConfig.setKeyword4( consultTeam.getSymptoms());
 | 
	
		
			
				|  |  |                         if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                             newConfig.setRemark(config.getRemark().replace("key1", "视频复诊"));
 | 
	
		
			
				|  |  |                         } else if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                             newConfig.setRemark(config.getRemark().replace("key1", "视频咨询"));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         //发起微信消息模板推送
 | 
	
		
			
				|  |  |                         newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
 | 
	
		
			
				|  |  |                         logger.info("眼科微信消息模板推送 视频咨询接诊提醒开始");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 scene = "spwzyytx";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotEmpty(outpatientId)){
 | 
	
		
			
				|  |  |                     WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
 | 
	
		
			
				|  |  |                     BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                     if ("16".equals(type)) {
 | 
	
		
			
				|  |  |                         newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊"));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                         newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     newConfig.setKeyword1( outpatientDO.getConsumerName());
 | 
	
		
			
				|  |  |                     newConfig.setKeyword2( outpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                     newConfig.setKeyword3( outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     newConfig.setKeyword4(DateUtil.dateToStrLong(outpatientDO.getRegisterDate()));
 | 
	
		
			
				|  |  |                     newConfig.setKeyword5(generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
 | 
	
		
			
				|  |  |                     //发起微信消息模板推送
 | 
	
		
			
				|  |  |                     newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                     logger.info("眼科微信消息模板推送 视频问诊预约提醒开始");
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     if (consultTeam!=null){
 | 
	
		
			
				|  |  |                         WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1);
 | 
	
		
			
				|  |  |                         BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                         if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                             newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         newConfig.setKeyword1(consPatientDO.getName());
 | 
	
		
			
				|  |  |                         newConfig.setKeyword2(hospitalDO.getDeptName());
 | 
	
		
			
				|  |  |                         newConfig.setKeyword3(consDoctorDO.getName());
 | 
	
		
			
				|  |  |                         newConfig.setKeyword4(DateUtil.dateToStrLong(consultTeam.getCzrq()));
 | 
	
		
			
				|  |  |                         newConfig.setKeyword5(generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId));
 | 
	
		
			
				|  |  |                         //发起微信消息模板推送
 | 
	
		
			
				|  |  |                         newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                         logger.info("眼科微信消息模板推送 视频咨询预约提醒开始");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 if ("17".equals(type)) {
 | 
	
		
			
				|  |  |                     newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询"));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 newConfig.setKeyword1( outpatientDO.getConsumerName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword2( outpatientDO.getDeptName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3( outpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword4(DateUtil.dateToStrLong(outpatientDO.getRegisterDate()));
 | 
	
		
			
				|  |  |                 newConfig.setKeyword5(generalDoctorWaitingNumber(doctorDO.getId(), wxId, outpatientId));
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 视频问诊预约提醒开始");
 | 
	
		
			
				|  |  |             } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //服务评价提醒
 | 
	
		
			
				|  |  |                 scene = "fwqjtx";
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_evaluate_notice", scene, 1);
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  |                 newConfig.setFirst(config.getFirst().replaceFirst("key1", consPatientDO.getName()));
 | 
	
		
			
				|  |  |                 newConfig.setKeyword2(config.getKeyword2() + hospitalDO.getOrgName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3(config.getKeyword3() + consDoctorDO.getName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword2(hospitalDO.getOrgName());
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3(consDoctorDO.getName());
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 服务评价提醒开始");
 | 
	
		
			
				|  |  |             } else if ("systemCancelRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //系统24小时取消复诊提醒
 | 
	
		
			
				|  |  |                 scene = "xtqxfz";
 | 
	
		
			
				|  |  |                 WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_system_cancel", scene, 1);
 | 
	
		
			
				|  |  |                 BeanUtils.copyProperties(config, newConfig);
 | 
	
	
		
			
				|  | @ -4536,6 +4432,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     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());
 | 
	
	
		
			
				|  | @ -4544,8 +4444,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 系统拒诊开始");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             logger.info("=======setUrl========" + newConfig.getUrl());
 | 
	
		
			
				|  |  |             WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
 | 
	
		
			
				|  |  |             for (BasePatientWechatDo one : ps) {
 | 
	
	
		
			
				|  | @ -4571,7 +4469,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String responseMsg="";
 | 
	
		
			
				|  |  |             //String prefix="https://www.xmheart.com";
 | 
	
		
			
				|  |  |             String prefix = "https://ih.xmheart.com/hlwyy";
 | 
	
	
		
			
				|  | @ -4584,7 +4481,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                         remark,
 | 
	
		
			
				|  |  |                         prefix+msgUrl);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if (consultTeam!=null&&consPatientDO!=null){
 | 
	
		
			
				|  |  |                 responseMsg = xzzxEntranceService.sendMes(wxId,
 | 
	
		
			
				|  |  |                         consPatientDO.getId(),
 | 
	
	
		
			
				|  | @ -4600,7 +4496,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             logger.info("XZZX_Msg_" + titelType + "=" + responseMsg);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             String responseMsg="";
 | 
	
		
			
				|  |  |             String prefix="https://hlwyy.xmzsh.com";
 | 
	
		
			
				|  |  |             if(StringUtils.isNotEmpty(outpatientId)){
 | 
	
	
		
			
				|  | @ -4633,6 +4528,147 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 发送顺丰物流提醒模板消息
 | 
	
		
			
				|  |  |      * @param outpatientId
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void sendSFWxTemplate(String outpatientId,String prescriptionId,String routeCode){
 | 
	
		
			
				|  |  |         String contentMsg = "";
 | 
	
		
			
				|  |  |         String first = "";
 | 
	
		
			
				|  |  |         String remark = "";
 | 
	
		
			
				|  |  |         String patientId = "";
 | 
	
		
			
				|  |  |         String drugName = "";
 | 
	
		
			
				|  |  |         String remindMsg="";
 | 
	
		
			
				|  |  |         String patienName = "";
 | 
	
		
			
				|  |  |         String mailNo ="";
 | 
	
		
			
				|  |  |         String msgUrl ="";
 | 
	
		
			
				|  |  |         WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
 | 
	
		
			
				|  |  |         if (wlyyOutpatientDO!=null){
 | 
	
		
			
				|  |  |             patientId = wlyyOutpatientDO.getConsumer();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (wlyyPrescriptionInfoDOS!=null&&wlyyPrescriptionInfoDOS.size()>0){
 | 
	
		
			
				|  |  |             drugName = wlyyPrescriptionInfoDOS.get(0).getDrugName();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionExpressageDO> wlyyPrescriptionExpressageDOS =prescriptionExpressageDao.findByOutpatientId(outpatientId);
 | 
	
		
			
				|  |  |         if (wlyyPrescriptionExpressageDOS!=null&&wlyyPrescriptionExpressageDOS.size()>0){
 | 
	
		
			
				|  |  |             mailNo = wlyyPrescriptionExpressageDOS.get(0).getMailno();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         switch (routeCode) {
 | 
	
		
			
				|  |  |             case "50":
 | 
	
		
			
				|  |  |                 remindMsg = "已发出";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "204":
 | 
	
		
			
				|  |  |                 remindMsg = "已在派件";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "80":
 | 
	
		
			
				|  |  |                 remindMsg = "已签收";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |             case "8000":
 | 
	
		
			
				|  |  |                 remindMsg = "已签收";
 | 
	
		
			
				|  |  |                 break;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = basePatientDao.findById(patientId);
 | 
	
		
			
				|  |  |         if (basePatientDO!=null){
 | 
	
		
			
				|  |  |             patienName = basePatientDO.getName();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)||"sd_tnzyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |             List<BasePatientWechatDo> ps = new ArrayList<BasePatientWechatDo>();
 | 
	
		
			
				|  |  |             if (StringUtils.isNotEmpty(outpatientId)){
 | 
	
		
			
				|  |  |                 ps = basePatientWechatDao.findByWechatIdAndPatientId(wechatId, patientId);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (ps.isEmpty()) {
 | 
	
		
			
				|  |  |                 logger.info("该用户" + patienName + "没有openid,无法推送模版消息,用户ID:" + patientId + "wechatId:" + wechatId);
 | 
	
		
			
				|  |  |                 return;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
 | 
	
		
			
				|  |  |             String scene = "sfxxtx";
 | 
	
		
			
				|  |  |             WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_sf_msg_notice", scene, 1);
 | 
	
		
			
				|  |  |             BeanUtils.copyProperties(config, newConfig);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             newConfig.setFirst(config.getFirst().replace("key1",remindMsg));
 | 
	
		
			
				|  |  |             newConfig.setKeyword1(config.getKeyword1().replace("key1",patienName).replace("key2",drugName));
 | 
	
		
			
				|  |  |             newConfig.setKeyword2("顺丰快递");
 | 
	
		
			
				|  |  |             newConfig.setKeyword3(mailNo);
 | 
	
		
			
				|  |  |             newConfig.setKeyword4(remindMsg);
 | 
	
		
			
				|  |  |             newConfig.setRemark(config.getRemark());
 | 
	
		
			
				|  |  |             newConfig.setUrl(newConfig.getUrl().replace("key1",outpatientId).replace("key2",prescriptionId));
 | 
	
		
			
				|  |  |             logger.info("=======setUrl========" + newConfig.getUrl());
 | 
	
		
			
				|  |  |             WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
 | 
	
		
			
				|  |  |             for (BasePatientWechatDo one : ps) {
 | 
	
		
			
				|  |  |                 logger.info("发送的消息="+ com.alibaba.fastjson.JSONObject.toJSONString(newConfig));
 | 
	
		
			
				|  |  |                 try {
 | 
	
		
			
				|  |  |                     logger.info("调用眼科微信模板消息接口的入参:AccessToken="+wxAccessTokenDO.getAccessToken()+"---Openid="+one.getOpenid());
 | 
	
		
			
				|  |  |                     weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(), one.getOpenid(), newConfig);
 | 
	
		
			
				|  |  |                     logger.info("发送成功");
 | 
	
		
			
				|  |  |                 } catch (Exception e) {
 | 
	
		
			
				|  |  |                     e.printStackTrace();
 | 
	
		
			
				|  |  |                     logger.info("发送失败,error="+e.getMessage());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //保存发送模板记录,
 | 
	
		
			
				|  |  |                 WxPushLogDO wxPushLogDO = new WxPushLogDO();
 | 
	
		
			
				|  |  |                 wxPushLogDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                 wxPushLogDO.setOpenid(one.getOpenid());
 | 
	
		
			
				|  |  |                 wxPushLogDO.setReceiver(patientId);
 | 
	
		
			
				|  |  |                 wxPushLogDO.setWechatId(wechatId);
 | 
	
		
			
				|  |  |                 wxPushLogDO.setReceiverName(patienName);
 | 
	
		
			
				|  |  |                 wxPushLogDO.setScene(scene);
 | 
	
		
			
				|  |  |                 wxPushLogDao.save(wxPushLogDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             first = "您好,您的处方订单物流"+remindMsg;
 | 
	
		
			
				|  |  |             contentMsg = "患者"+patienName+"的处方药品订单,"+drugName+"等,当前"+remindMsg+"。物流方:「顺丰快递」,物流单号:"+mailNo+"。";
 | 
	
		
			
				|  |  |             logger.info("推送物流模板消息参数first:"+first+"====contentMsg:"+contentMsg);
 | 
	
		
			
				|  |  |             msgUrl="/ims-wx/index.html#/returnVisit/logistics?outpatientId="+outpatientId+"&prescriptionCode="+prescriptionId;
 | 
	
		
			
				|  |  |             String responseMsg = "";
 | 
	
		
			
				|  |  |             if ("xm_xzzx_wx".equalsIgnoreCase(wechatId)) {
 | 
	
		
			
				|  |  |                 //String prefix="https://www.xmheart.com";
 | 
	
		
			
				|  |  |                 String prefix = "https://ih.xmheart.com/hlwyy";
 | 
	
		
			
				|  |  |                 if(StringUtils.isNotEmpty(outpatientId)){
 | 
	
		
			
				|  |  |                     responseMsg = xzzxEntranceService.sendMes(wechatId,
 | 
	
		
			
				|  |  |                             patientId,
 | 
	
		
			
				|  |  |                             basePatientDO.getIdcard(),
 | 
	
		
			
				|  |  |                             first,
 | 
	
		
			
				|  |  |                             contentMsg,
 | 
	
		
			
				|  |  |                             remark,
 | 
	
		
			
				|  |  |                             prefix+msgUrl);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 logger.info("url="+prefix+msgUrl);
 | 
	
		
			
				|  |  |                 String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
 | 
	
		
			
				|  |  |                 logger.info("发送的信息="+msg);
 | 
	
		
			
				|  |  |                 logger.info("心脏模板消息发送返回结果:"+responseMsg);
 | 
	
		
			
				|  |  |             } else if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)) {
 | 
	
		
			
				|  |  |                 String prefix = "https://hlwyy.xmzsh.com";
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotEmpty(outpatientId)) {
 | 
	
		
			
				|  |  |                     responseMsg = entranceService.ehospitalNotice(
 | 
	
		
			
				|  |  |                             patienName,
 | 
	
		
			
				|  |  |                             basePatientDO.getIdcard(),
 | 
	
		
			
				|  |  |                             basePatientDO.getMobile(),
 | 
	
		
			
				|  |  |                             first,
 | 
	
		
			
				|  |  |                             prefix + msgUrl,
 | 
	
		
			
				|  |  |                             contentMsg,
 | 
	
		
			
				|  |  |                             remark
 | 
	
		
			
				|  |  |                     );
 | 
	
		
			
				|  |  |                     logger.info("中山发送模板消息返回结果="+responseMsg);
 | 
	
		
			
				|  |  |                     System.out.println("结束发送模板消息");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //保存发送模板记录,
 | 
	
		
			
				|  |  |             WxPushLogDO wxPushLogDO = new WxPushLogDO();
 | 
	
		
			
				|  |  |             wxPushLogDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             wxPushLogDO.setReceiver(patientId);
 | 
	
		
			
				|  |  |             wxPushLogDO.setWechatId(wechatId);
 | 
	
		
			
				|  |  |             wxPushLogDO.setReceiverName(patienName);
 | 
	
		
			
				|  |  |             wxPushLogDO.setRequest(first+contentMsg+msgUrl);
 | 
	
		
			
				|  |  |             wxPushLogDO.setResponse(responseMsg);
 | 
	
		
			
				|  |  |             wxPushLogDO.setTempName("顺丰推送的物流消息");
 | 
	
		
			
				|  |  |             wxPushLogDao.save(wxPushLogDO);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<WlyyHospitalSysDictDO> findCancelReasonList() {
 | 
	
		
			
				|  |  |         return sysDictDao.findByDictName("PatientCancel");
 | 
	
	
		
			
				|  | @ -6590,7 +6626,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             String str[] = realOrder.split(";");
 | 
	
		
			
				|  |  |             Object result = "";
 | 
	
		
			
				|  |  |             for (int i=0;i<str.length;i++){
 | 
	
		
			
				|  |  |                 WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,str[i]);
 | 
	
		
			
				|  |  |                 WlyyPrescriptionDO wlyyPrescriptionDOS = new WlyyPrescriptionDO();
 | 
	
		
			
				|  |  |                 if(StringUtils.isNoneBlank(admNo)){
 | 
	
		
			
				|  |  |                     wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo,str[i]);
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionDO> wlyyPrescriptionDOList = prescriptionDao.findByRealOrderList(str[i]);
 | 
	
		
			
				|  |  |                     if (wlyyPrescriptionDOList!=null&&wlyyPrescriptionDOList.size()!=0){
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDOS =wlyyPrescriptionDOList.get(0);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOS != null);
 | 
	
		
			
				|  |  |                 if (wlyyPrescriptionDOS != null) {
 | 
	
		
			
				|  |  |                     List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId", wlyyPrescriptionDOS.getOutpatientId());
 | 
	
	
		
			
				|  | @ -8385,7 +8429,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<WlyyPrescriptionCheckDO> findPrescriptionCheck(String prescriptionId) {
 | 
	
		
			
				|  |  |         return prescriptionCheckDao.findByPrescriptionId(prescriptionId);
 | 
	
		
			
				|  |  |         return prescriptionCheckDao.findByPrescriptionIdAndStatus(prescriptionId);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -9652,6 +9696,56 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
 | 
	
		
			
				|  |  |         logger.info("返回日志"+response);
 | 
	
		
			
				|  |  |         if(StringUtils.isNoneBlank(response)){
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |             if (jsonObject.getString("code").equalsIgnoreCase("200")){
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("info"));
 | 
	
		
			
				|  |  |                 if (StringUtils.isNoneBlank(jsonObject1.getString("token"))){
 | 
	
		
			
				|  |  |                     yxTokenMappingDO1.setAccid(userId);
 | 
	
		
			
				|  |  |                     yxTokenMappingDO1.setToken(jsonObject1.getString("token"));
 | 
	
		
			
				|  |  |                     yxTokenMappingDao.save(yxTokenMappingDO1);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 return jsonObject1.getString("token");
 | 
	
		
			
				|  |  |             }else if (jsonObject.getString("code").equalsIgnoreCase("414")&&jsonObject.getString("desc").contains("already")){
 | 
	
		
			
				|  |  |                 return  refreshToken(userId);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 重置云信token
 | 
	
		
			
				|  |  |      * @param userId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String refreshToken(String userId){
 | 
	
		
			
				|  |  |         YxTokenMappingDO yxTokenMappingDO = yxTokenMappingDao.findMappingByAccid(userId);
 | 
	
		
			
				|  |  |         if (yxTokenMappingDO!=null){
 | 
	
		
			
				|  |  |             return yxTokenMappingDO.getToken();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
 | 
	
		
			
				|  |  |         if (sysDictDO==null){
 | 
	
		
			
				|  |  |             return  "找不到对应的key";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String appKey = sysDictDO.getDictValue();
 | 
	
		
			
				|  |  |         String appSecret = hospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |         String nonce =  randomInt(10);
 | 
	
		
			
				|  |  |         String curTime = String.valueOf((new Date()).getTime() / 1000L);
 | 
	
		
			
				|  |  |         String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
 | 
	
		
			
				|  |  |         String url = "https://api.netease.im/nimserver/user/refreshToken.action";
 | 
	
		
			
				|  |  |         Map<String,Object> httpPost = new HashedMap();
 | 
	
		
			
				|  |  |         // 设置请求的header
 | 
	
		
			
				|  |  |         httpPost.put("AppKey", appKey);
 | 
	
		
			
				|  |  |         httpPost.put("Nonce", nonce);
 | 
	
		
			
				|  |  |         httpPost.put("CurTime", curTime);
 | 
	
		
			
				|  |  |         httpPost.put("CheckSum", checkSum);
 | 
	
		
			
				|  |  |         httpPost.put("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
 | 
	
		
			
				|  |  |         List<NameValuePair> nvps = new ArrayList<NameValuePair>();
 | 
	
		
			
				|  |  |         nvps.add(new BasicNameValuePair("accid", userId));
 | 
	
		
			
				|  |  |         YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
 | 
	
		
			
				|  |  |         String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
 | 
	
		
			
				|  |  |         logger.info("重置云信"+response);
 | 
	
		
			
				|  |  |         if(StringUtils.isNoneBlank(response)){
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |             if (jsonObject.getString("code").equalsIgnoreCase("200")){
 | 
	
	
		
			
				|  | @ -9667,6 +9761,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public static void main(String[] args) {
 | 
	
		
			
				|  |  |         String ss = DateUtil.getStringDateShort();
 | 
	
		
			
				|  |  |         System.out.println(ss);
 | 
	
	
		
			
				|  | @ -10197,4 +10292,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return "接口调用失败";
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 根据doctorid获取待服务数量
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Long waitUpdoorCount(String doctor) {
 | 
	
		
			
				|  |  |        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("waitUpdoorCount");
 | 
	
		
			
				|  |  |        String url = "";
 | 
	
		
			
				|  |  |        if (wlyyHospitalSysDictDO!=null){
 | 
	
		
			
				|  |  |            url = wlyyHospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        logger.info("waitUpdoorCountUrl:"+url);
 | 
	
		
			
				|  |  |        if (StringUtils.isNoneBlank(doctor)){
 | 
	
		
			
				|  |  |            url+="?doctor="+doctor;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |         Long doorServiceCount = 0L;
 | 
	
		
			
				|  |  |        try {
 | 
	
		
			
				|  |  |            String res = httpClientUtil.get(url,"UTF-8");
 | 
	
		
			
				|  |  |            logger.info("waitUpdoorCountres:"+res);
 | 
	
		
			
				|  |  |            if (StringUtils.isNoneBlank(res)){
 | 
	
		
			
				|  |  |                com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
 | 
	
		
			
				|  |  |                if (jsonObject!=null&&"200".equalsIgnoreCase(jsonObject.getString("status"))){
 | 
	
		
			
				|  |  |                    String dataCount = jsonObject.getString("data");
 | 
	
		
			
				|  |  |                    doorServiceCount = Long.parseLong(dataCount);
 | 
	
		
			
				|  |  |                }
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |        }catch (Exception e){
 | 
	
		
			
				|  |  |            return doorServiceCount;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        return doorServiceCount;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |