|
@ -1,6 +1,18 @@
|
|
|
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.*;
|
|
@ -2623,19 +2635,26 @@ 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 (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) {
|
|
|
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());
|
|
|
}
|
|
|
} else {
|
|
|
prescription.setStatus(20);
|
|
|
}
|
|
|
}
|
|
|
prescriptionDao.save(prescription);
|
|
@ -4456,7 +4475,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
|
|
|
logger.info("眼科微信消息模板推送 处方支付提醒开始");
|
|
|
logger.info("极光消息推送 医生拒诊开始");
|
|
|
wxTempalteJPush("prescription_pay",outpatientDO,null,"","","","");
|
|
|
wxTempalteJPush("prescription_pay",outpatientDO,null,"","","",remindMsg);
|
|
|
}else if ("videoOrderRemind".equalsIgnoreCase(titelType)) {
|
|
|
//视频问诊预约提醒
|
|
|
scene = "spwzyytx";
|
|
@ -9358,12 +9377,16 @@ 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<>();
|
|
|
BeanUtils.copyProperties(inspectionDOS,inspectionVOS);
|
|
|
convertToModels(inspectionDOS, inspectionVOS, WlyyInspectionVO.class);
|
|
|
//BeanUtils.copyProperties(inspectionDOS,inspectionVOS);
|
|
|
singlePre.setInspectionVOs(inspectionVOS);
|
|
|
}
|
|
|
// List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
|
|
@ -11468,16 +11491,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param extras 扩展参数 {"type","","id":""}
|
|
|
* @return
|
|
|
*/
|
|
|
public String jPushMessage(String userId, String alert, String title, com.alibaba.fastjson.JSONObject extras){
|
|
|
/* List<WlyyHospitalSysDictDO> hospitalSysDictDOList = hospitalSysDictDao.findByDictName("JPUSH");
|
|
|
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 (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKey")){
|
|
|
appKey=hospitalSysDictDO.getDictValue();
|
|
|
}
|
|
|
if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecret")){
|
|
|
masterSecret = hospitalSysDictDO.getDictValue();
|
|
|
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);
|
|
@ -11494,6 +11526,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
.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()
|
|
@ -11501,12 +11536,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
.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();
|
|
|
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
|
|
@ -11517,14 +11562,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
logger.info("HTTP Status: " + e.getStatus());
|
|
|
logger.info("Error Code: " + e.getErrorCode());
|
|
|
logger.info("Error Message: " + e.getErrorMessage());
|
|
|
}*/
|
|
|
/*logger.info("极光推送返回日志==="+response);*/
|
|
|
/* WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
|
|
|
httpLogDO.setCode("JPUSH");
|
|
|
httpLogDO.setCreateTime(new Date());
|
|
|
httpLogDO.setRequest(jsonObject.toJSONString());
|
|
|
httpLogDO.setResponse(response);
|
|
|
wlyyHttpLogDao.save(httpLogDO);*/
|
|
|
}
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
@ -11533,6 +11572,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
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);
|
|
@ -11574,6 +11614,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",31);
|
|
|
jsonObject.put("id",wlyyOutpatientDO.getId());
|
|
|
isDoctor="1";
|
|
|
} else if("prescription_pay".equalsIgnoreCase(templateCode)){
|
|
|
BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
|
|
|
if(baseJpushTemplateDO!=null){
|
|
@ -11583,28 +11624,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
}
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",6);
|
|
|
jsonObject.put("id",wlyyOutpatientDO.getId());
|
|
|
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();
|
|
@ -11643,32 +11691,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
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){
|
|
@ -11679,6 +11734,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",8);
|
|
|
jsonObject.put("id",prescriptionId);
|
|
|
isDoctor="1";
|
|
|
} else if("logistics_remind".equalsIgnoreCase(templateCode)){
|
|
|
BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
|
|
|
if(baseJpushTemplateDO!=null){
|
|
@ -11690,8 +11746,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
userId = wlyyOutpatientDO.getConsumer();
|
|
|
jsonObject.put("type",32);
|
|
|
jsonObject.put("id",prescriptionId);
|
|
|
jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
|
|
|
}
|
|
|
|
|
|
return jPushMessage(userId,content,title,jsonObject);
|
|
|
return jPushMessage(isDoctor,userId,content,title,jsonObject);
|
|
|
}
|
|
|
}
|