|
@ -2,10 +2,7 @@ package com.yihu.jw.hospital.prescription.service;
|
|
|
|
|
|
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 +24,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;
|
|
@ -292,7 +290,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
private YkyySMSService ykyySMSService;
|
|
|
@Autowired
|
|
|
private TnyyEntranceService tnyyEntranceService;
|
|
|
|
|
|
@Autowired
|
|
|
private BaseJpushTemplateDao baseJpushTemplateDao;
|
|
|
|
|
|
|
|
|
@Value("${demo.flag}")
|
|
@ -2608,7 +2607,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);
|
|
@ -4398,6 +4397,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";
|
|
@ -4431,6 +4434,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";
|
|
@ -4443,6 +4448,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
//发起微信消息模板推送
|
|
|
newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
|
|
|
logger.info("眼科微信消息模板推送 处方支付提醒开始");
|
|
|
logger.info("极光消息推送 医生拒诊开始");
|
|
|
wxTempalteJPush("prescription_pay",outpatientDO,null,"","","","");
|
|
|
}else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
|
|
|
//视频问诊预约提醒
|
|
|
scene = "spwzyytx";
|
|
@ -4472,6 +4479,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
newConfig.setKeyword3(consDoctorDO.getName());
|
|
|
//发起微信消息模板推送
|
|
|
newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult());
|
|
|
logger.info("极光消息推送 医生拒诊开始");
|
|
|
wxTempalteJPush("give_score",outpatientDO,consultTeam,"","","","");
|
|
|
logger.info("眼科微信消息模板推送 服务评价提醒开始");
|
|
|
} else if ("systemCancelRemind".equalsIgnoreCase(titelType)) {
|
|
|
//系统24小时取消复诊提醒
|
|
@ -4667,6 +4676,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+"。";
|
|
@ -11482,4 +11493,169 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
public String wxTempalteJPush(String templateCode,WlyyOutpatientDO wlyyOutpatientDO ,ConsultTeamDo consultTeamDo,String drugName ,String mailNo,String mailStatus,String prescriptionId){
|
|
|
String userId = "";
|
|
|
String content = "";
|
|
|
String title="";
|
|
|
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.replace("{{咨询类型}}","图文咨询");
|
|
|
}else if(9==consultTeamDo.getType()){
|
|
|
content.replace("{{咨询类型}}","图文复诊");
|
|
|
}
|
|
|
else if(16==consultTeamDo.getType()){
|
|
|
content.replace("{{咨询类型}}","视频复诊");
|
|
|
}
|
|
|
else if(17==consultTeamDo.getType()){
|
|
|
content.replace("{{咨询类型}}","视频咨询");
|
|
|
}
|
|
|
title=baseJpushTemplateDO.getPushHeader();
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
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();
|
|
|
content.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.replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",31);
|
|
|
jsonObject.put("id",wlyyOutpatientDO.getId());
|
|
|
} else if("prescription_pay".equalsIgnoreCase(templateCode)){
|
|
|
BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
|
|
|
if(baseJpushTemplateDO!=null){
|
|
|
content = baseJpushTemplateDO.getPushContent();
|
|
|
content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
title=baseJpushTemplateDO.getPushHeader();
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",6);
|
|
|
jsonObject.put("id",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("{{咨询类型}}","图文复诊");
|
|
|
}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",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);
|
|
|
}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);
|
|
|
}else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询");
|
|
|
jsonObject.put("type",41);
|
|
|
}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",42);
|
|
|
}else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊");
|
|
|
jsonObject.put("type",3);
|
|
|
}else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
|
|
|
content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询").replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询");
|
|
|
jsonObject.put("type",43);
|
|
|
}
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getDoctor();
|
|
|
jsonObject.put("id",wlyyOutpatientDO.getId());
|
|
|
} else if("prescription_refuse".equalsIgnoreCase(templateCode)){
|
|
|
BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
|
|
|
if(baseJpushTemplateDO!=null){
|
|
|
content = baseJpushTemplateDO.getPushContent();
|
|
|
content.replace("{{医生姓名}}",wlyyOutpatientDO.getDoctorName()).replace("{患者姓名}}",wlyyOutpatientDO.getPatientName());
|
|
|
title=baseJpushTemplateDO.getPushHeader().replace("{{患者姓名}}",wlyyOutpatientDO.getDoctorName());
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",8);
|
|
|
jsonObject.put("id",prescriptionId);
|
|
|
} else if("logistics_remind".equalsIgnoreCase(templateCode)){
|
|
|
BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
|
|
|
if(baseJpushTemplateDO!=null){
|
|
|
content = baseJpushTemplateDO.getPushContent();
|
|
|
content.replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{药品名称}}",drugName)
|
|
|
.replace("{{物流状态}}",mailStatus).replace("{{运单号}}",mailNo);
|
|
|
title=baseJpushTemplateDO.getPushHeader();
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",32);
|
|
|
jsonObject.put("id",prescriptionId);
|
|
|
}
|
|
|
|
|
|
return jPushMessage(userId,content,title,jsonObject);
|
|
|
}
|
|
|
}
|