|  | @ -1,11 +1,21 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.hospital.prescription.service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import cn.jiguang.common.ClientConfig;
 | 
	
		
			
				|  |  | import cn.jiguang.common.resp.APIConnectionException;
 | 
	
		
			
				|  |  | import cn.jiguang.common.resp.APIRequestException;
 | 
	
		
			
				|  |  | import cn.jpush.api.JPushClient;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.PushResult;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.model.Platform;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.model.PushPayload;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.model.audience.Audience;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.model.audience.AudienceTarget;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.model.notification.AndroidNotification;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.model.notification.IosNotification;
 | 
	
		
			
				|  |  | import cn.jpush.api.push.model.notification.Notification;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.BaseDictJobTitleDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.BaseJobCategoryDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.DictDeptDescDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.service.BaseDoctorInfoService;
 | 
	
	
		
			
				|  | @ -27,6 +37,7 @@ import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.dict.BaseJpushTemplateDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
 | 
	
	
		
			
				|  | @ -86,6 +97,7 @@ import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.Pkis.PKIService_PortType;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.encode.Base64;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.BasePatientWechatDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WechatDao;
 | 
	
	
		
			
				|  | @ -95,7 +107,7 @@ import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.service.WxAccessTokenService;
 | 
	
		
			
				|  |  | import com.yihu.jw.yx.dao.YxTokenMappingDao;
 | 
	
		
			
				|  |  | import com.yihu.mysql.query.BaseJpaService;
 | 
	
		
			
				|  |  | import com.yihu.utils.pinyin.PinyinUtil;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.utils.security.MD5;
 | 
	
		
			
				|  |  | import com.ylzinfo.ehc.EhcHandler;
 | 
	
		
			
				|  |  | import com.ylzinfo.ehc.common.utils.DateUtils;
 | 
	
	
		
			
				|  | @ -131,8 +143,6 @@ import java.text.ParseException;
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import static javafx.scene.input.KeyCode.L;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * Created by Trick on 2019/5/17.
 | 
	
		
			
				|  |  |  */
 | 
	
	
		
			
				|  | @ -288,7 +298,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     private YkyySMSService ykyySMSService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private TnyyEntranceService tnyyEntranceService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseJpushTemplateDao baseJpushTemplateDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${demo.flag}")
 | 
	
	
		
			
				|  | @ -2588,6 +2599,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     ins.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                     ins.setPrescriptionId(prescription.getId());
 | 
	
		
			
				|  |  |                     ins.setOutpatientId(outPatientId);
 | 
	
		
			
				|  |  |                     /*if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
 | 
	
		
			
				|  |  |                         String code = ins.getCode();
 | 
	
		
			
				|  |  |                         com.alibaba.fastjson.JSONArray jsonArray = ykyyEntranceService.findZlxm("",code,"","","");
 | 
	
		
			
				|  |  |                         if (jsonArray!=null&&jsonArray.size()>0){
 | 
	
		
			
				|  |  |                             com.alibaba.fastjson.JSONObject deptobject = jsonArray.getJSONObject(0);
 | 
	
		
			
				|  |  |                             String deptNo = deptobject.getString("dept");
 | 
	
		
			
				|  |  |                             ins.setDept(StringUtils.isNoneBlank(ins.getDept())?ins.getDept():deptNo);
 | 
	
		
			
				|  |  |                             String yqdm = deptobject.getString("yqdm");
 | 
	
		
			
				|  |  |                             ins.setOrgCode(StringUtils.isNoneBlank(ins.getOrgCode())?ins.getOrgCode():yqdm);
 | 
	
		
			
				|  |  |                             ins.setOrgName("1001".equalsIgnoreCase(ins.getOrgCode())?"思北院区":"五缘院区");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }*/
 | 
	
		
			
				|  |  |                     System.out.println("____outpatientId=="+outPatientId);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 //保存检查检验。
 | 
	
	
		
			
				|  | @ -2604,7 +2627,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             prescription.setRegFee(outpatientDO.getFee());
 | 
	
		
			
				|  |  |             prescription.setPrescribeTime(new Date());
 | 
	
		
			
				|  |  |             //保存费用
 | 
	
		
			
				|  |  |             prescriptionDao.save(prescription);
 | 
	
		
			
				|  |  |             prescription = prescriptionDao.save(prescription);
 | 
	
		
			
				|  |  |             if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
 | 
	
		
			
				|  |  |                 outpatientDO.setStatus("2");
 | 
	
		
			
				|  |  |                 outpatientDao.save(outpatientDO);
 | 
	
	
		
			
				|  | @ -2624,11 +2647,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                         } else {
 | 
	
		
			
				|  |  |                             ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
 | 
	
		
			
				|  |  |                         List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                         if (list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |                             ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
 | 
	
		
			
				|  |  |                     if (StringUtils.isNotBlank(inspectionJson)) {
 | 
	
		
			
				|  |  |                         if (StringUtils.isNotBlank(infoJsons)) {
 | 
	
		
			
				|  |  |                             List<WlyyPrescriptionInfoDO> infoDOs = (List<WlyyPrescriptionInfoDO>) com.alibaba.fastjson.JSONArray.parseArray(infoJsons, WlyyPrescriptionInfoDO.class);
 | 
	
		
			
				|  |  |                             if (infoDOs != null && infoDOs.size() > 0) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             } else {
 | 
	
		
			
				|  |  |                                 prescription.setStatus(20);
 | 
	
		
			
				|  |  |                             }
 | 
	
		
			
				|  |  |                         } else {
 | 
	
		
			
				|  |  |                             prescription.setStatus(20);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             sendWxTemplateMsg(wechatId, outpatientDO.getId(), null, "", "prescriptionPayRemind", prescription.getId());
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 prescriptionDao.save(prescription);
 | 
	
		
			
				|  |  |                 result.put("code", 1);
 | 
	
		
			
				|  |  |                 result.put("mes", "诊断完成");
 | 
	
		
			
				|  |  |                 result.put("prescriptionId",prescription.getId());
 | 
	
	
		
			
				|  | @ -3724,7 +3765,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 rs.put("winNo", org.getWinNo());
 | 
	
		
			
				|  |  |                 rs.put("deptName", hospitalDOs.get(0).getDeptName());
 | 
	
		
			
				|  |  |                 rs.put("dept", hospitalDOs.get(0).getDeptCode());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(withWork) && "1".equals(withWork)) {
 | 
	
		
			
				|  |  |                     List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor, hospitalDOs.get(0).getOrgCode(),"");
 | 
	
		
			
				|  |  |                     rs.put("workTime", times);
 | 
	
	
		
			
				|  | @ -4395,6 +4435,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 医生拒诊开始");
 | 
	
		
			
				|  |  |                 logger.info("极光消息推送 医生拒诊开始");
 | 
	
		
			
				|  |  |                 wxTempalteJPush("cancel_remind",outpatientDO,null,"","","","");
 | 
	
		
			
				|  |  |                 /*String res = wxTempalteJPush(outpatientDO.getConsumer(),newConfig.getFirst(),"医生拒绝了你的问诊",type,outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("JPUSH res==="+res);*/
 | 
	
		
			
				|  |  |             }else if("outPatientTimeOutRemind".equals(titelType)){
 | 
	
		
			
				|  |  |                 //就诊等待过长提示
 | 
	
		
			
				|  |  |                 scene="jzddgcts";
 | 
	
	
		
			
				|  | @ -4428,6 +4472,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 就诊支付提醒开始");
 | 
	
		
			
				|  |  |                 logger.info("极光消息推送 就诊支付提醒开始");
 | 
	
		
			
				|  |  |                 wxTempalteJPush("outpatient_pay",outpatientDO,null,"","","","");
 | 
	
		
			
				|  |  |             } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //处方开具支付提醒
 | 
	
		
			
				|  |  |                 scene = "cfzfts";
 | 
	
	
		
			
				|  | @ -4440,6 +4486,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 处方支付提醒开始");
 | 
	
		
			
				|  |  |                 logger.info("极光消息推送 医生拒诊开始");
 | 
	
		
			
				|  |  |                 wxTempalteJPush("prescription_pay",outpatientDO,null,"","","",remindMsg);
 | 
	
		
			
				|  |  |             }else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //视频问诊预约提醒
 | 
	
		
			
				|  |  |                 scene = "spwzyytx";
 | 
	
	
		
			
				|  | @ -4469,6 +4517,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 newConfig.setKeyword3(consDoctorDO.getName());
 | 
	
		
			
				|  |  |                 //发起微信消息模板推送
 | 
	
		
			
				|  |  |                 newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
 | 
	
		
			
				|  |  |                 logger.info("极光消息推送 医生拒诊开始");
 | 
	
		
			
				|  |  |                 wxTempalteJPush("give_score",null,consultTeam,"","","","");
 | 
	
		
			
				|  |  |                 logger.info("眼科微信消息模板推送 服务评价提醒开始");
 | 
	
		
			
				|  |  |             } else if ("systemCancelRemind".equalsIgnoreCase(titelType)) {
 | 
	
		
			
				|  |  |                 //系统24小时取消复诊提醒
 | 
	
	
		
			
				|  | @ -4664,6 +4714,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 wxPushLogDO.setScene(scene);
 | 
	
		
			
				|  |  |                 wxPushLogDao.save(wxPushLogDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //发送极光消息推送
 | 
	
		
			
				|  |  |            wxTempalteJPush("logistics_remind",wlyyOutpatientDO,null,drugName,mailNo,remindMsg,prescriptionId);
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             first = "您好,您的处方订单物流"+remindMsg;
 | 
	
		
			
				|  |  |             contentMsg = "患者"+patienName+"的处方药品订单,"+drugName+"等,当前"+remindMsg+"。物流方:「顺丰快递」,物流单号:"+mailNo+"。";
 | 
	
	
		
			
				|  | @ -4858,7 +4910,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 "room.consult_type AS \"consult_type\"," +
 | 
	
		
			
				|  |  |                 "outpatient.consumer as \"consumer\", " +
 | 
	
		
			
				|  |  |                 "outpatient.consumer_name as \"consumerName\"," +
 | 
	
		
			
				|  |  |                 "outpatient.consumer_mobile as \"consumerMobile\", ";
 | 
	
		
			
				|  |  |                 "outpatient.consumer_mobile as \"consumerMobile\", "+
 | 
	
		
			
				|  |  |                 "outpatient.create_time as \"create_date\", ";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wechatId)) {
 | 
	
		
			
				|  |  |             if(flag){
 | 
	
		
			
				|  |  |                 sql += "date_format(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
 | 
	
	
		
			
				|  | @ -4908,6 +4961,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }else if (2==type) {//视频复诊
 | 
	
		
			
				|  |  |             //在线复诊
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_type !=3 AND room.consult_type =2";
 | 
	
		
			
				|  |  |         } else if(0==type) {
 | 
	
		
			
				|  |  |             sql += " AND room.consult_type =1";
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_type !=2";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -5484,7 +5539,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql += " WHERE  1=1 ";
 | 
	
		
			
				|  |  |         sql += " WHERE  1=1 and h.del = '1' ";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(chargType)) {
 | 
	
	
		
			
				|  | @ -5685,6 +5740,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
 | 
	
		
			
				|  |  |             count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<WlyyHospitalSysDictDO> doctorFrontList = wlyyHospitalSysDictDao.findByDictNameOrderBySort("doctorFrontList");
 | 
	
		
			
				|  |  |         if (doctorFrontList!=null&&doctorFrontList.size()>0){
 | 
	
		
			
				|  |  |             List<Map<String,Object>> frontDoctor = new ArrayList<>();
 | 
	
		
			
				|  |  |             if (list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |                 for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:doctorFrontList){
 | 
	
		
			
				|  |  |                     for(Map<String,Object> map: list){
 | 
	
		
			
				|  |  |                         if(map.get("id").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
 | 
	
		
			
				|  |  |                             map.put("doctorFrontSort",wlyyHospitalSysDictDO.getSort());
 | 
	
		
			
				|  |  |                             logger.info("doctorFrontSort",wlyyHospitalSysDictDO.getSort());
 | 
	
		
			
				|  |  |                             logger.info("doctorId",wlyyHospitalSysDictDO.getDictCode());
 | 
	
		
			
				|  |  |                             frontDoctor.add(map);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:doctorFrontList){
 | 
	
		
			
				|  |  |                     for(Map<String,Object> map1: list){
 | 
	
		
			
				|  |  |                         if (wlyyHospitalSysDictDO.getDictCode().equalsIgnoreCase(map1.get("id").toString())){
 | 
	
		
			
				|  |  |                             list.remove(map1);
 | 
	
		
			
				|  |  |                             break;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 for(Map<String,Object> map1: list){
 | 
	
		
			
				|  |  |                     frontDoctor.add(map1);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 list = frontDoctor;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("findDoctorByHospitalAndDiseaseAndDept end:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
 | 
	
		
			
				|  |  |         logger.info("sql:" + sql);
 | 
	
		
			
				|  |  |         MixEnvelop envelop =new MixEnvelop();
 | 
	
	
		
			
				|  | @ -5694,7 +5779,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         envelop.setCurrPage(page);
 | 
	
		
			
				|  |  |         return envelop;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取常见疾病、热门部门、医生拒绝接诊原因 字典
 | 
	
		
			
				|  |  |      *
 | 
	
	
		
			
				|  | @ -8457,6 +8541,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO.setCheckReason(reason);
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(10);
 | 
	
		
			
				|  |  |                 List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                 List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |                 if (list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     if(inspectionDOS!=null&&inspectionDOS.size()>0){
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setStatus(20);
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setCheckReason("只开检查检验,不开药品无需审方");
 | 
	
		
			
				|  |  |                         wlyyPrescriptionDO.setCheckStatus(2);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 wlyyPrescriptionDO.setStatus(11);
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -8777,6 +8871,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                        content.deleteCharAt(content.length()-1);
 | 
	
		
			
				|  |  |                        icd10Code.deleteCharAt(icd10Code.length()-1);
 | 
	
		
			
				|  |  |                    }
 | 
	
		
			
				|  |  |                    wlyyOutpatientDO.setStatus("2");
 | 
	
		
			
				|  |  |                    wlyyOutpatientDO.setIcd10Name(content.toString());
 | 
	
		
			
				|  |  |                    wlyyOutpatientDO.setIcd10(icd10Code.toString());
 | 
	
		
			
				|  |  |                    outpatientDao.save(wlyyOutpatientDO);
 | 
	
	
		
			
				|  | @ -9298,9 +9393,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         for (WlyyPrescriptionVO singlePre:list){
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionInfoDO> infoDOs = prescriptionInfoDao.findByPrescriptionId(singlePre.getId(),1);
 | 
	
		
			
				|  |  |             logger.info("singlePreId===="+singlePre.getId());
 | 
	
		
			
				|  |  |             logger.info("infoDOs"+infoDOs);
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionInfoVO> infoVOS = new ArrayList<>();
 | 
	
		
			
				|  |  |             BeanUtils.copyProperties(infoDOs,infoVOS);
 | 
	
		
			
				|  |  |             convertToModels(infoDOs, infoVOS, WlyyPrescriptionInfoVO.class);
 | 
	
		
			
				|  |  |             logger.info("infoVOS"+infoVOS);
 | 
	
		
			
				|  |  |             singlePre.setInfoVOs(infoVOS);
 | 
	
		
			
				|  |  |             List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(singlePre.getId(),1);
 | 
	
		
			
				|  |  |             List<WlyyInspectionVO> inspectionVOS = new ArrayList<>();
 | 
	
		
			
				|  |  |             convertToModels(inspectionDOS, inspectionVOS, WlyyInspectionVO.class);
 | 
	
		
			
				|  |  |             //BeanUtils.copyProperties(inspectionDOS,inspectionVOS);
 | 
	
		
			
				|  |  |             singlePre.setInspectionVOs(inspectionVOS);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | //        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
 | 
	
		
			
				|  |  |         logger.info("countSql=" + countSql.toString());
 | 
	
	
		
			
				|  | @ -11395,4 +11498,290 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     public  void updateChannelId(String id,String channelId){
 | 
	
		
			
				|  |  |         outpatientDao.updateChannelId(id,channelId);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param userId 用户id 实例:["22222"]
 | 
	
		
			
				|  |  |      * @param alert 通知内容
 | 
	
		
			
				|  |  |      * @param title 通知标题
 | 
	
		
			
				|  |  |      * @param extras 扩展参数 {"type","","id":""}
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String jPushMessage(String isDoctor,String userId, String alert, String title, com.alibaba.fastjson.JSONObject extras){
 | 
	
		
			
				|  |  |         List<WlyyHospitalSysDictDO> hospitalSysDictDOList = hospitalSysDictDao.findByDictName("JPUSH");
 | 
	
		
			
				|  |  |         String appKey = null;
 | 
	
		
			
				|  |  |         String masterSecret =null;
 | 
	
		
			
				|  |  |         for (WlyyHospitalSysDictDO hospitalSysDictDO:hospitalSysDictDOList){
 | 
	
		
			
				|  |  |             if ("1".equalsIgnoreCase(isDoctor)){
 | 
	
		
			
				|  |  |                 if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKey")){
 | 
	
		
			
				|  |  |                     appKey=hospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecret")){
 | 
	
		
			
				|  |  |                     masterSecret = hospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKeyPatient")){
 | 
	
		
			
				|  |  |                     appKey=hospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecretPatient")){
 | 
	
		
			
				|  |  |                     masterSecret = hospitalSysDictDO.getDictValue();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         logger.info("appKey"+appKey+"======"+"masterSecret"+masterSecret);
 | 
	
		
			
				|  |  |         logger.info("addExtra++++"+extras.toString());
 | 
	
		
			
				|  |  |         JPushClient jPushClient = new JPushClient(masterSecret, appKey, null, ClientConfig.getInstance());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         PushPayload payload = PushPayload.newBuilder()
 | 
	
		
			
				|  |  |                 .setPlatform(Platform.all())
 | 
	
		
			
				|  |  |                 .setAudience(Audience.newBuilder()
 | 
	
		
			
				|  |  |                         .addAudienceTarget(AudienceTarget.alias(userId)).build())
 | 
	
		
			
				|  |  |                 .setNotification(Notification.newBuilder()
 | 
	
		
			
				|  |  |                         .addPlatformNotification(IosNotification.newBuilder()
 | 
	
		
			
				|  |  |                                 .setAlert(alert)
 | 
	
		
			
				|  |  |                                 .setBadge(5)
 | 
	
		
			
				|  |  |                                 .setSound("default")
 | 
	
		
			
				|  |  |                                 .addExtra("type", extras.getString("type"))
 | 
	
		
			
				|  |  |                                 .addExtra("id", extras.getString("id"))
 | 
	
		
			
				|  |  |                                 .addExtra("outpatientId", extras.getString("outpatientId"))
 | 
	
		
			
				|  |  |                                 .addExtra("consultType", extras.getString("consultType"))
 | 
	
		
			
				|  |  |                                 .addExtra("patientName", extras.getString("patientName"))
 | 
	
		
			
				|  |  |                                 .setBadge(1)
 | 
	
		
			
				|  |  |                                 .build())
 | 
	
		
			
				|  |  |                         .addPlatformNotification(AndroidNotification.newBuilder()
 | 
	
		
			
				|  |  |                                 .setAlert(alert)
 | 
	
		
			
				|  |  |                                 .setTitle(title)
 | 
	
		
			
				|  |  |                                 .setBuilderId(1)
 | 
	
		
			
				|  |  |                                 .addExtra("type", extras.getString("type"))
 | 
	
		
			
				|  |  |                                 .addExtra("outpatientId", extras.getString("outpatientId"))
 | 
	
		
			
				|  |  |                                 .addExtra("id", extras.getString("id"))
 | 
	
		
			
				|  |  |                                 .addExtra("consultType", extras.getString("consultType"))
 | 
	
		
			
				|  |  |                                 .addExtra("patientName", extras.getString("patientName"))
 | 
	
		
			
				|  |  |                                 .build())
 | 
	
		
			
				|  |  |                         .build())
 | 
	
		
			
				|  |  |                 .build();
 | 
	
		
			
				|  |  |         if (extras.get("outpatientId")!=null){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             PushResult result = jPushClient.sendPush(payload);
 | 
	
		
			
				|  |  |             logger.info("极光推送返回日志==="+result);
 | 
	
		
			
				|  |  |             WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
 | 
	
		
			
				|  |  |             httpLogDO.setCode("JPUSH");
 | 
	
		
			
				|  |  |             httpLogDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             /*httpLogDO.setRequest(jsonObject.toJSONString());
 | 
	
		
			
				|  |  |             httpLogDO.setResponse(result);*/
 | 
	
		
			
				|  |  |             wlyyHttpLogDao.save(httpLogDO);
 | 
	
		
			
				|  |  |             logger.info("Got result - " + result);
 | 
	
		
			
				|  |  |         } catch (APIConnectionException e) {
 | 
	
		
			
				|  |  |             // Connection error, should retry later
 | 
	
		
			
				|  |  |             logger.error("Connection error, should retry later", e);
 | 
	
		
			
				|  |  |         } catch (APIRequestException e) {
 | 
	
		
			
				|  |  |             // Should review the error, and fix the request
 | 
	
		
			
				|  |  |             logger.error("Should review the error, and fix the request", e);
 | 
	
		
			
				|  |  |             logger.info("HTTP Status: " + e.getStatus());
 | 
	
		
			
				|  |  |             logger.info("Error Code: " + e.getErrorCode());
 | 
	
		
			
				|  |  |             logger.info("Error Message: " + e.getErrorMessage());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     public String wxTempalteJPush(String templateCode,WlyyOutpatientDO wlyyOutpatientDO ,ConsultTeamDo consultTeamDo,String drugName ,String mailNo,String mailStatus,String prescriptionId){
 | 
	
		
			
				|  |  |         String userId = "";
 | 
	
		
			
				|  |  |         String content = "";
 | 
	
		
			
				|  |  |         String title="";
 | 
	
		
			
				|  |  |         String isDoctor="0";//0患者 1医生
 | 
	
		
			
				|  |  |         com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |         if("give_score".equalsIgnoreCase(templateCode)){//评分
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 content = baseJpushTemplateDO.getPushContent();
 | 
	
		
			
				|  |  |                 if(1==consultTeamDo.getType()){
 | 
	
		
			
				|  |  |                     content= content.replace("{{咨询类型}}","图文咨询");
 | 
	
		
			
				|  |  |                 }else if(9==consultTeamDo.getType()){
 | 
	
		
			
				|  |  |                     content= content.replace("{{咨询类型}}","图文复诊");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 else if(16==consultTeamDo.getType()){
 | 
	
		
			
				|  |  |                     content=  content.replace("{{咨询类型}}","视频复诊");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 else if(17==consultTeamDo.getType()){
 | 
	
		
			
				|  |  |                     content=  content.replace("{{咨询类型}}","视频咨询");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 title=baseJpushTemplateDO.getPushHeader();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = consultTeamDo.getPatient();
 | 
	
		
			
				|  |  |             jsonObject.put("type",10);
 | 
	
		
			
				|  |  |             jsonObject.put("id",consultTeamDo.getConsult());
 | 
	
		
			
				|  |  |         }else if("video_invite".equalsIgnoreCase(templateCode)){//视频邀请
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 content = baseJpushTemplateDO.getPushContent().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 title=baseJpushTemplateDO.getPushHeader();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getConsumer();
 | 
	
		
			
				|  |  |             jsonObject.put("type",30);
 | 
	
		
			
				|  |  |             jsonObject.put("id",wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |         }else if("consult_remind".equalsIgnoreCase(templateCode)){//医生向患者发消息提醒
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 content = baseJpushTemplateDO.getPushContent();
 | 
	
		
			
				|  |  |                 content= content.replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 title=baseJpushTemplateDO.getPushHeader().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getConsumer();
 | 
	
		
			
				|  |  |             jsonObject.put("type",31);
 | 
	
		
			
				|  |  |             jsonObject.put("id",wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else if("consult_remind_doctor".equalsIgnoreCase(templateCode)){//患者向医生发消息提醒
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 //content = baseJpushTemplateDO.getPushContent();
 | 
	
		
			
				|  |  |                 content= drugName;
 | 
	
		
			
				|  |  |                 title=baseJpushTemplateDO.getPushHeader().replace("{{患者姓名}}",consultTeamDo.getName());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = consultTeamDo.getDoctor();
 | 
	
		
			
				|  |  |             jsonObject.put("type",33);
 | 
	
		
			
				|  |  |             jsonObject.put("id",consultTeamDo.getRelationCode());
 | 
	
		
			
				|  |  |             jsonObject.put("consultType",consultTeamDo.getType());
 | 
	
		
			
				|  |  |             jsonObject.put("patientName",consultTeamDo.getName());
 | 
	
		
			
				|  |  |             isDoctor = "1";
 | 
	
		
			
				|  |  |         }  else if("prescription_pay".equalsIgnoreCase(templateCode)){//处方支付提醒
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 content = baseJpushTemplateDO.getPushContent();
 | 
	
		
			
				|  |  |                 content= content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |                 title=baseJpushTemplateDO.getPushHeader();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getConsumer();
 | 
	
		
			
				|  |  |             jsonObject.put("type",6);
 | 
	
		
			
				|  |  |             jsonObject.put("id",prescriptionId);
 | 
	
		
			
				|  |  |             jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |         } else if("outpatient_pay".equalsIgnoreCase(templateCode)){//诊查费支付提醒
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
 | 
	
		
			
				|  |  |                     jsonObject.put("consultType",9);
 | 
	
		
			
				|  |  |                 }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
 | 
	
		
			
				|  |  |                     jsonObject.put("consultType",16);
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
 | 
	
		
			
				|  |  |                     jsonObject.put("consultType",1);
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
 | 
	
		
			
				|  |  |                     jsonObject.put("consultType",17);
 | 
	
		
			
				|  |  |                 }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
 | 
	
		
			
				|  |  |                     jsonObject.put("consultType",12);
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
 | 
	
		
			
				|  |  |                     jsonObject.put("consultType",15);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getConsumer();
 | 
	
		
			
				|  |  |             jsonObject.put("type",11);
 | 
	
		
			
				|  |  |             jsonObject.put("id",wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |         } else if("cancel_remind".equalsIgnoreCase(templateCode)){//医生取消接诊提醒
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
 | 
	
		
			
				|  |  |                 }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
 | 
	
		
			
				|  |  |                 }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询");
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getConsumer();
 | 
	
		
			
				|  |  |             jsonObject.put("type",12);
 | 
	
		
			
				|  |  |             jsonObject.put("id",wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |         }else if("outpatient_remind".equalsIgnoreCase(templateCode)){//患者发起复诊向医生推消息
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊");
 | 
	
		
			
				|  |  |                     jsonObject.put("type",1);
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |                 }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     content+= "视频复诊预约时间为:"+wlyyOutpatientDO.getRegisterDate();
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊");
 | 
	
		
			
				|  |  |                     jsonObject.put("type",2);
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
 | 
	
		
			
				|  |  |                     jsonObject.put("type",18);
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询");
 | 
	
		
			
				|  |  |                     content+= "视频咨询预约时间为:"+wlyyOutpatientDO.getRegisterDate();
 | 
	
		
			
				|  |  |                     jsonObject.put("type",17);
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |                 }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
 | 
	
		
			
				|  |  |                     jsonObject.put("type",3);
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |                 }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                     content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                     title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
 | 
	
		
			
				|  |  |                     jsonObject.put("type",15);
 | 
	
		
			
				|  |  |                     jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getDoctor();
 | 
	
		
			
				|  |  |             jsonObject.put("id",wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |             isDoctor="1";
 | 
	
		
			
				|  |  |         } else if("prescription_refuse".equalsIgnoreCase(templateCode)){//处方审方失败提醒
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 content = baseJpushTemplateDO.getPushContent();
 | 
	
		
			
				|  |  |                 content=  content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
 | 
	
		
			
				|  |  |                 title=baseJpushTemplateDO.getPushHeader().replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getDoctor();
 | 
	
		
			
				|  |  |             jsonObject.put("type",8);
 | 
	
		
			
				|  |  |             jsonObject.put("id",prescriptionId);
 | 
	
		
			
				|  |  |             isDoctor="1";
 | 
	
		
			
				|  |  |         } else if("logistics_remind".equalsIgnoreCase(templateCode)){//物流消息提醒
 | 
	
		
			
				|  |  |             BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
 | 
	
		
			
				|  |  |             if(baseJpushTemplateDO!=null){
 | 
	
		
			
				|  |  |                 content = baseJpushTemplateDO.getPushContent();
 | 
	
		
			
				|  |  |                 content=  content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{药品名称}}",drugName)
 | 
	
		
			
				|  |  |                 .replace("{{物流状态}}",mailStatus).replace("{{运单号}}",mailNo);
 | 
	
		
			
				|  |  |                 title=baseJpushTemplateDO.getPushHeader();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             userId = wlyyOutpatientDO.getConsumer();
 | 
	
		
			
				|  |  |             jsonObject.put("type",32);
 | 
	
		
			
				|  |  |             jsonObject.put("id",prescriptionId);
 | 
	
		
			
				|  |  |             jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return jPushMessage(isDoctor,userId,content,title,jsonObject);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |