|  | @ -13,6 +13,8 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 |  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.im.ConsultDo;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.im.ConsultTeamDo;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
 |  | import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.org.BaseOrgDO;
 |  | import com.yihu.jw.entity.base.org.BaseOrgDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
												
											
												
													
														
															|  | @ -243,7 +245,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private DictDeptDescDao dictDeptDescDao;
 |  |     private DictDeptDescDao dictDeptDescDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Value("${demo.flag}")
 |  |     @Value("${demo.flag}")
 | 
												
													
														
															|  |     private boolean demoFlag;
 |  |     private boolean demoFlag;
 | 
												
													
														
															|  |     @Value("${wechat.id}")
 |  |     @Value("${wechat.id}")
 | 
												
											
												
													
														
															|  | @ -2102,7 +2103,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 //先下单
 |  |                 //先下单
 | 
												
													
														
															|  |                 businessOrderService.savePrescriptionOrder(prescription.getId());
 |  |                 businessOrderService.savePrescriptionOrder(prescription.getId());
 | 
												
													
														
															|  |                 //同步his
 |  |                 //同步his
 | 
												
													
														
															|  |                 ykyyEntranceService.findByRealOrder(prescription.getId());
 |  | 
 | 
												
													
														
															|  | 
 |  |                 ykyyEntranceService.findByRealOrder(prescription.getId(),demoFlag);
 | 
												
													
														
															|  |                 List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
 |  |                 List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
 | 
												
													
														
															|  |                 if (prescriptionDOList != null && prescriptionDOList.size() != 0) {
 |  |                 if (prescriptionDOList != null && prescriptionDOList.size() != 0) {
 | 
												
													
														
															|  |                     WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
 |  |                     WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
 | 
												
											
												
													
														
															|  | @ -3326,12 +3327,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
 |  |                 if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
 | 
												
													
														
															|  |                     data.put("type", "9");
 |  |                     data.put("type", "9");
 | 
												
													
														
															|  |                     msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
 |  |                     msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
 | 
												
													
														
															|  |                     sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(), "9", "doctorRefuse", null);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuse", "");
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
 |  |                 if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
 | 
												
													
														
															|  |                     data.put("type", "16");
 |  |                     data.put("type", "16");
 | 
												
													
														
															|  |                     msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
 |  |                     msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
 | 
												
													
														
															|  |                     sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(), "16", "doctorRefuse", null);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuse", "");
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 data.put("msg", msg);
 |  |                 data.put("msg", msg);
 | 
												
													
														
															|  |                 messageDO.setData(data.toString());
 |  |                 messageDO.setData(data.toString());
 | 
												
											
												
													
														
															|  | @ -3378,72 +3379,101 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |      * @param titelType
 |  |      * @param titelType
 | 
												
													
														
															|  |      * @param remindMsg
 |  |      * @param remindMsg
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public void sendWxTemplateMsg(String wxId, String outpatientId, String type, String titelType, String remindMsg) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void sendWxTemplateMsg(String wxId, String outpatientId,ConsultTeamDo consultTeam,  String type, String titelType, String remindMsg) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         BaseDoctorDO consDoctorDO = new BaseDoctorDO();
 | 
												
													
														
															|  | 
 |  |         BasePatientDO consPatientDO = new BasePatientDO();
 | 
												
													
														
															|  | 
 |  |         //获取咨询的信息
 | 
												
													
														
															|  | 
 |  |         if (consultTeam!=null){
 | 
												
													
														
															|  | 
 |  |             consDoctorDO = baseDoctorDao.findById(consultTeam.getDoctor());
 | 
												
													
														
															|  | 
 |  |             consPatientDO = basePatientDao.findById(consultTeam.getPatient());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         WlyyOutpatientDO outpatientDO = new WlyyOutpatientDO();
 | 
												
													
														
															|  | 
 |  |         BaseDoctorDO doctorDO = new BaseDoctorDO();
 | 
												
													
														
															|  | 
 |  |         BasePatientDO patientDO = new BasePatientDO();
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotEmpty(outpatientId)){
 | 
												
													
														
															|  | 
 |  |             outpatientDO = outpatientDao.findById(outpatientId);
 | 
												
													
														
															|  | 
 |  |             doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
 | 
												
													
														
															|  | 
 |  |             patientDO = basePatientDao.findById(outpatientDO.getPatient());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
 |  | 
 | 
												
													
														
															|  |         BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
 |  | 
 | 
												
													
														
															|  |         BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
 |  | 
 | 
												
													
														
															|  |         String contentMsg = "";
 |  |         String contentMsg = "";
 | 
												
													
														
															|  |         String first = "";
 |  |         String first = "";
 | 
												
													
														
															|  |         String remark = "";
 |  |         String remark = "";
 | 
												
													
														
															|  |         if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
 |  |         if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
 | 
												
													
														
															|  |             if ("9".equals(type)) {
 |  |             if ("9".equals(type)) {
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
 | 
												
													
														
															|  |                 first = outpatientDO.getPatientName() + ",您好!您的图文复诊已取消";
 |  |                 first = outpatientDO.getPatientName() + ",您好!您的图文复诊已取消";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             if ("16".equals(type)) {
 |  |             if ("16".equals(type)) {
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
 | 
												
													
														
															|  |                 first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
 |  |                 first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         } else if ("payRemind".equalsIgnoreCase(titelType)) {
 |  |         } else if ("payRemind".equalsIgnoreCase(titelType)) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             if ("9".equals(type)) {
 |  |             if ("9".equals(type)) {
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
 | 
												
													
														
															|  |                 first = outpatientDO.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。";
 |  |                 first = outpatientDO.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             } else if ("16".equals(type)) {
 |  |             } else if ("16".equals(type)) {
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
 | 
												
													
														
															|  |                 first = outpatientDO.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。";
 |  |                 first = outpatientDO.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。";
 | 
												
													
														
															|  |             } else if ("1".equals(type)) {
 |  | 
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
 |  | 
 | 
												
													
														
															|  |                 first = outpatientDO.getPatientName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if ("1".equals(type)) {
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
 | 
												
													
														
															|  | 
 |  |                 first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。";
 | 
												
													
														
															|  |             } else if ("17".equals(type)) {
 |  |             } else if ("17".equals(type)) {
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
 |  | 
 | 
												
													
														
															|  |                 first = outpatientDO.getPatientName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息";
 | 
												
													
														
															|  | 
 |  |                 first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 |  |         } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) {
 | 
												
													
														
															|  |             first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。";
 |  |             first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。";
 | 
												
													
														
															|  |             contentMsg = "通知内容:医生已为您开具处方,请及时支付。";
 |  | 
 | 
												
													
														
															|  |             remark = "备注:点击完成支付,如您已支付请忽略本条信息";
 |  | 
 | 
												
													
														
															|  | 
 |  |             contentMsg = "医生已为您开具处方,请及时支付。";
 | 
												
													
														
															|  | 
 |  |             remark = "点击完成支付,如您已支付请忽略本条信息";
 | 
												
													
														
															|  |         } else if ("msgRemind".equalsIgnoreCase(titelType)) {
 |  |         } else if ("msgRemind".equalsIgnoreCase(titelType)) {
 | 
												
													
														
															|  |             first = outpatientDO.getPatientName() + ",您好!";
 |  |             first = outpatientDO.getPatientName() + ",您好!";
 | 
												
													
														
															|  |             contentMsg = "通知内容:" + remindMsg;
 |  | 
 | 
												
													
														
															|  |             remark = "备注:请您尽快回复";
 |  | 
 | 
												
													
														
															|  | 
 |  |             contentMsg = "" + remindMsg;
 | 
												
													
														
															|  | 
 |  |             remark = "请您尽快回复";
 | 
												
													
														
															|  |         } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
 |  |         } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) {
 | 
												
													
														
															|  |             first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
 |  |             first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。";
 | 
												
													
														
															|  |             if ("16".equals(type)) {
 |  |             if ("16".equals(type)) {
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您的视频复诊已开始,错过将重新排队";
 |  | 
 | 
												
													
														
															|  |                 remark = "备注:点击消息进入视频诊室接听视频通话,开始视频咨询。";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您的视频复诊已开始,错过将重新排队";
 | 
												
													
														
															|  | 
 |  |                 remark = "点击消息进入视频诊室接听视频通话,开始视频咨询。";
 | 
												
													
														
															|  |             } else if ("17".equals(type)) {
 |  |             } else if ("17".equals(type)) {
 | 
												
													
														
															|  |                 contentMsg = "通知内容:您的视频咨询已开始,错过将重新排队";
 |  | 
 | 
												
													
														
															|  |                 remark = "备注:点击消息进入视频诊室接听视频通话,开始视频复诊。";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "您的视频咨询已开始,错过将重新排队";
 | 
												
													
														
															|  | 
 |  |                 remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
 |  |         } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             if ("16".equals(type)) {
 |  |             if ("16".equals(type)) {
 | 
												
													
														
															|  |                 first = "您的视频复诊已预约成功。";
 |  |                 first = "您的视频复诊已预约成功。";
 | 
												
													
														
															|  |                 contentMsg = "通知内容:预计" + outpatientDO.getDoctorName() + "医生将于" + outpatientDO.getRegisterDate() + " 与您进行视频复诊。请留意微信公众号消息。";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "预计" + outpatientDO.getDoctorName() + "医生将于" + DateUtil.dateToStrLong(outpatientDO.getRegisterDate()) + " 与您进行视频复诊。请留意微信公众号消息。";
 | 
												
													
														
															|  |             } else if ("17".equals(type)) {
 |  |             } else if ("17".equals(type)) {
 | 
												
													
														
															|  |                 first = "您的视频咨询已预约成功。";
 |  |                 first = "您的视频咨询已预约成功。";
 | 
												
													
														
															|  |                 contentMsg = "通知内容:预计" + outpatientDO.getDoctorName() + "医生将于" + outpatientDO.getRegisterDate() + " 与您进行视频咨询。请留意微信公众号消息。";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 contentMsg = "预计" + consDoctorDO.getName() + "医生将于" + DateUtil.dateToStrLong(consultTeam.getCzrq()) + " 与您进行视频咨询。请留意微信公众号消息。";
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             remark = "备注:咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
 |  | 
 | 
												
													
														
															|  | 
 |  |             remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
 | 
												
													
														
															|  |         } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
 |  |         } else if ("evaluateRemind".equalsIgnoreCase(titelType)) {
 | 
												
													
														
															|  |             first = outpatientDO.getPatientName() + ",您好!您有1条专家咨询已结束,请及时对咨询医生进行评价。";
 |  | 
 | 
												
													
														
															|  |             contentMsg = "通知内容:请对" + outpatientDO.getDoctorName() + "医生的服务进行评价";
 |  | 
 | 
												
													
														
															|  | 
 |  |             if (consultTeam.getType()!=null&&1==consultTeam.getType()){
 | 
												
													
														
															|  | 
 |  |                 first = consultTeam.getName() + ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if (consultTeam.getType()!=null&&9==consultTeam.getType()){
 | 
												
													
														
															|  | 
 |  |                 first = consultTeam.getName() + ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if (consultTeam.getType()!=null&&16==consultTeam.getType()){
 | 
												
													
														
															|  | 
 |  |                 first = consultTeam.getName() + ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if (consultTeam.getType()!=null&&17==consultTeam.getType()){
 | 
												
													
														
															|  | 
 |  |                 first = consultTeam.getName() + ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             contentMsg = "请对" + consDoctorDO.getName() + "医生的服务进行评价";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -4506,17 +4536,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 if (one.getId().equalsIgnoreCase(workTimeDO.getId())) {
 |  |                 if (one.getId().equalsIgnoreCase(workTimeDO.getId())) {
 | 
												
													
														
															|  |                     continue;
 |  |                     continue;
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 try {
 |  | 
 | 
												
													
														
															|  |                     //与医院与自己排班比较  是否冲突  第一组最后时间小于等于第二组最前时间 || 第一组最前时间大于等于第二组最后时间
 |  | 
 | 
												
													
														
															|  |                     if (one.getEndTime().before(workTimeDO.getStartTime()) || one.getStartTime().after(workTimeDO.getEndTime())) {
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                     } else {
 |  | 
 | 
												
													
														
															|  |                         throw new Exception("您选择的时间与“开始时间-结束时间”的医院排班/自己排班冲突,请重新选择!");
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                 } catch (Exception e) {
 |  | 
 | 
												
													
														
															|  |                     e.printStackTrace();
 |  | 
 | 
												
													
														
															|  |                     return false;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 //与医院与自己排班比较  是否冲突  第一组最后时间小于等于第二组最前时间 || 第一组最前时间大于等于第二组最后时间
 | 
												
													
														
															|  | 
 |  |                 if (one.getEndTime().before(workTimeDO.getStartTime()) || one.getStartTime().after(workTimeDO.getEndTime())) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                 } else {
 | 
												
													
														
															|  | 
 |  |                     throw new Exception("您选择的时间与“开始时间-结束时间”的医院排班/自己排班冲突,请重新选择!");
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             doctorWorkTimeDao.save(workTimeDO);
 |  |             doctorWorkTimeDao.save(workTimeDO);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -5261,11 +5288,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 if ("1".equals(outpatient.getType())) {
 |  |                 if ("1".equals(outpatient.getType())) {
 | 
												
													
														
															|  |                     systemMessageDO.setTitle("图文复诊");
 |  |                     systemMessageDO.setTitle("图文复诊");
 | 
												
													
														
															|  |                     systemMessageDO.setType("1");
 |  |                     systemMessageDO.setType("1");
 | 
												
													
														
															|  |                     saveInquirySystemMessage(outpatient);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     saveInquirySystemMessage(outpatient,null);
 | 
												
													
														
															|  |                 } else {
 |  |                 } else {
 | 
												
													
														
															|  |                     systemMessageDO.setTitle("视频复诊预约成功");
 |  |                     systemMessageDO.setTitle("视频复诊预约成功");
 | 
												
													
														
															|  |                     systemMessageDO.setType("2");
 |  |                     systemMessageDO.setType("2");
 | 
												
													
														
															|  |                     saveInquirySystemMessage(outpatient);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     saveInquirySystemMessage(outpatient,null);
 | 
												
													
														
															|  |                     msg = "您的视频复诊已预约成功。\n" +
 |  |                     msg = "您的视频复诊已预约成功。\n" +
 | 
												
													
														
															|  |                             "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
 |  |                             "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
 | 
												
													
														
															|  |                     systemMessageDO.setReceiver(outpatient.getDoctor());
 |  |                     systemMessageDO.setReceiver(outpatient.getDoctor());
 | 
												
											
												
													
														
															|  | @ -5283,7 +5310,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                     data.put("msg", msg);
 |  |                     data.put("msg", msg);
 | 
												
													
														
															|  |                     systemMessageDO.setData(data.toString());
 |  |                     systemMessageDO.setData(data.toString());
 | 
												
													
														
															|  |                     systemMessageService.saveMessage(systemMessageDO);
 |  |                     systemMessageService.saveMessage(systemMessageDO);
 | 
												
													
														
															|  |                     sendWxTemplateMsg(wechatId, outpatient.getId(), "17", "videoOrderRemind", null);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", "");
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -5299,44 +5326,86 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         return systemMessageDO;
 |  |         return systemMessageDO;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public void saveInquirySystemMessage(WlyyOutpatientDO outpatient) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public void saveInquirySystemMessage(WlyyOutpatientDO outpatient,ConsultTeamDo consultTeamDo) {
 | 
												
													
														
															|  |         SystemMessageDO systemMessageDO = new SystemMessageDO();
 |  |         SystemMessageDO systemMessageDO = new SystemMessageDO();
 | 
												
													
														
															|  |         String msg = "";
 |  |         String msg = "";
 | 
												
													
														
															|  |         String type = "";
 |  |         String type = "";
 | 
												
													
														
															|  |         if ("1".equals(outpatient.getType())) {
 |  | 
 | 
												
													
														
															|  |             type = "9";
 |  | 
 | 
												
													
														
															|  |             msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
 |  | 
 | 
												
													
														
															|  |         } else {
 |  | 
 | 
												
													
														
															|  |             type = "16";
 |  | 
 | 
												
													
														
															|  |             msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         systemMessageDO.setTitle("支付提醒");
 |  |         systemMessageDO.setTitle("支付提醒");
 | 
												
													
														
															|  |         systemMessageDO.setType("11");
 |  |         systemMessageDO.setType("11");
 | 
												
													
														
															|  |         systemMessageDO.setSender(outpatient.getDoctor());
 |  | 
 | 
												
													
														
															|  |         systemMessageDO.setSenderName(outpatient.getDoctorName());
 |  | 
 | 
												
													
														
															|  |         systemMessageDO.setRelationCode(outpatient.getId());
 |  | 
 | 
												
													
														
															|  |         systemMessageDO.setReceiver(outpatient.getPatient());
 |  | 
 | 
												
													
														
															|  |         systemMessageDO.setReceiverName(outpatient.getPatientName());
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         JSONObject data = new JSONObject();
 |  |         JSONObject data = new JSONObject();
 | 
												
													
														
															|  |         try {
 |  | 
 | 
												
													
														
															|  |             data.put("name", outpatient.getPatientName());
 |  | 
 | 
												
													
														
															|  |             data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
 |  | 
 | 
												
													
														
															|  |             data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
 |  | 
 | 
												
													
														
															|  |             data.put("question", outpatient.getDescription());
 |  | 
 | 
												
													
														
															|  |             data.put("msg", msg);
 |  | 
 | 
												
													
														
															|  |             data.put("type", type);
 |  | 
 | 
												
													
														
															|  |             systemMessageDO.setData(data.toString());
 |  | 
 | 
												
													
														
															|  |             systemMessageService.saveMessage(systemMessageDO);
 |  | 
 | 
												
													
														
															|  |         } catch (Exception e) {
 |  | 
 | 
												
													
														
															|  |             e.printStackTrace();
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (outpatient!=null){
 | 
												
													
														
															|  | 
 |  |             if ("1".equals(outpatient.getType())) {
 | 
												
													
														
															|  | 
 |  |                 type = "9";
 | 
												
													
														
															|  | 
 |  |                 msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
 | 
												
													
														
															|  | 
 |  |             } else if ("2".equals(outpatient.getType())){
 | 
												
													
														
															|  | 
 |  |                 type = "16";
 | 
												
													
														
															|  | 
 |  |                 msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setSender(outpatient.getDoctor());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setSenderName(outpatient.getDoctorName());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setRelationCode(outpatient.getId());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setReceiver(outpatient.getPatient());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setReceiverName(outpatient.getPatientName());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |            data = new JSONObject();
 | 
												
													
														
															|  | 
 |  |             try {
 | 
												
													
														
															|  | 
 |  |                 data.put("name", outpatient.getPatientName());
 | 
												
													
														
															|  | 
 |  |                 data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
 | 
												
													
														
															|  | 
 |  |                 data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
 | 
												
													
														
															|  | 
 |  |                 data.put("question", outpatient.getDescription());
 | 
												
													
														
															|  | 
 |  |                 data.put("msg", msg);
 | 
												
													
														
															|  | 
 |  |                 data.put("type", type);
 | 
												
													
														
															|  | 
 |  |                 systemMessageDO.setData(data.toString());
 | 
												
													
														
															|  | 
 |  |                 systemMessageService.saveMessage(systemMessageDO);
 | 
												
													
														
															|  | 
 |  |             } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |                 e.printStackTrace();
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             sendWxTemplateMsg(wechatId, outpatient.getId(),null, type, "payRemind", "");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (consultTeamDo!=null){
 | 
												
													
														
															|  | 
 |  |             if (consultTeamDo.getType().equals("17")){
 | 
												
													
														
															|  | 
 |  |                 type = "17";
 | 
												
													
														
															|  | 
 |  |                 msg = outpatient.getPatientName() + ",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
 | 
												
													
														
															|  | 
 |  |             }else if (consultTeamDo.getType().equals("1")){
 | 
												
													
														
															|  | 
 |  |                 type = "1";
 | 
												
													
														
															|  | 
 |  |                 msg = outpatient.getPatientName() + ",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             BaseDoctorDO doctorDO = baseDoctorDao.findById(consultTeamDo.getDoctor());
 | 
												
													
														
															|  | 
 |  |             BasePatientDO patientDO = basePatientDao.findById(consultTeamDo.getPatient());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setSender(consultTeamDo.getDoctor());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setSenderName(doctorDO.getName());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setRelationCode(consultTeamDo.getConsult());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setReceiver(consultTeamDo.getPatient());
 | 
												
													
														
															|  | 
 |  |             systemMessageDO.setReceiverName(consultTeamDo.getName());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |            data = new JSONObject();
 | 
												
													
														
															|  | 
 |  |             try {
 | 
												
													
														
															|  | 
 |  |                 data.put("name", outpatient.getPatientName());
 | 
												
													
														
															|  | 
 |  |                 data.put("age", IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
 | 
												
													
														
															|  | 
 |  |                 data.put("gender", IdCardUtil.getSexForIdcard_new(patientDO.getIdcard()));
 | 
												
													
														
															|  | 
 |  |                 data.put("question", consultTeamDo.getSymptoms());
 | 
												
													
														
															|  | 
 |  |                 data.put("msg", msg);
 | 
												
													
														
															|  | 
 |  |                 data.put("type", type);
 | 
												
													
														
															|  | 
 |  |                 systemMessageDO.setData(data.toString());
 | 
												
													
														
															|  | 
 |  |                 systemMessageService.saveMessage(systemMessageDO);
 | 
												
													
														
															|  | 
 |  |             } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |                 e.printStackTrace();
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             sendWxTemplateMsg(wechatId, "",consultTeamDo, type, "payRemind", "");
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
 |  |         BasePatientDO patient = basePatientDao.findById(outpatient.getPatient());
 | 
												
													
														
															|  |         if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
 |  |         if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
 | 
												
													
														
															|  |             ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
 |  |             ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         sendWxTemplateMsg(wechatId, outpatient.getId(), type, "payRemind", null);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -6385,7 +6454,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |             if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
 |  |             if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
 | 
												
													
														
															|  |                 ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
 |  |                 ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             sendWxTemplateMsg(wxId, outpatientDO.getId(), "", "prescriptionPayRemind", null);
 |  | 
 | 
												
													
														
															|  | 
 |  |             sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", "");
 | 
												
													
														
															|  |         } else {
 |  |         } else {
 | 
												
													
														
															|  |             wlyyPrescriptionDO.setId(prescriptionId);
 |  |             wlyyPrescriptionDO.setId(prescriptionId);
 | 
												
													
														
															|  |             wlyyPrescriptionDO.setCheckStatus(status);
 |  |             wlyyPrescriptionDO.setCheckStatus(status);
 |