diff --git a/src/main/java/com/ynxbd/common/action/PWEAction.java b/src/main/java/com/ynxbd/common/action/PWEAction.java index 44214c8..eb48875 100644 --- a/src/main/java/com/ynxbd/common/action/PWEAction.java +++ b/src/main/java/com/ynxbd/common/action/PWEAction.java @@ -10,6 +10,7 @@ import com.ynxbd.common.dao.PWEReportDao; import com.ynxbd.common.helper.common.JsonHelper; import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; +import com.ynxbd.wx.config.MessagePushConfig; import com.ynxbd.wx.pwe.PWEConfig; import com.ynxbd.wx.pwe.PWEHelper; import com.ynxbd.wx.pwe.bean.PWEResult; @@ -107,9 +108,11 @@ public class PWEAction extends BaseAction { String hospitalId = body.getString("hospitalId"); String registeredId = body.getString("registeredId"); String progress = body.getString("progress"); + Register order = new PWEReportDao().selectRegOrderInfo(registeredId); log.info("[预问诊]6.3 预问诊完成通知 partnerId={}, hospitalId={}, registeredId={}, progress={}", partnerId, hospitalId, registeredId, progress); if ("1".equals(progress)) { log.info("进度100%"); + MessagePushConfig.regAIReport(order.getPatientId()); } return PWEResult.success(); } catch (Exception e) { diff --git a/src/main/java/com/ynxbd/common/service/RegService.java b/src/main/java/com/ynxbd/common/service/RegService.java index c5e8b1f..142fe98 100644 --- a/src/main/java/com/ynxbd/common/service/RegService.java +++ b/src/main/java/com/ynxbd/common/service/RegService.java @@ -214,11 +214,17 @@ public class RegService { // 短信通知 smsNotice(reg); + if (MerchantEnum.WX.equals(merchantEnum)) { MessagePushConfig.regPush(merchantEnum, reg); + + MessagePushConfig.regAI(merchantEnum,reg); + // 挂号导航推送 MessagePushConfig.regNavigatePush(merchantEnum, reg); + + // 电子健康卡上报数据 HCodeService.regPayReportHISData(openid, patientId, reg.getDeptName(), reg.getRegDate()); } diff --git a/src/main/java/com/ynxbd/wx/config/MessagePushConfig.java b/src/main/java/com/ynxbd/wx/config/MessagePushConfig.java index dd27d21..5e80877 100644 --- a/src/main/java/com/ynxbd/wx/config/MessagePushConfig.java +++ b/src/main/java/com/ynxbd/wx/config/MessagePushConfig.java @@ -7,6 +7,7 @@ import com.ynxbd.common.bean.pay.Register; import com.ynxbd.common.dao.PatientDao; import com.ynxbd.common.helper.ProperHelper; import com.ynxbd.common.helper.http.OkHttpHelper; +import com.ynxbd.wx.pwe.PWEHelper; import com.ynxbd.wx.utils.DesEncryptHelper; import lombok.extern.slf4j.Slf4j; import okhttp3.FormBody; @@ -20,6 +21,8 @@ public class MessagePushConfig { private MessagePushConfig() { } + public static final String ORGANIZENAME; + // 挂号导航是否开启功能===================================== public static final boolean REG_NAVIGATE_IS_ENABLE; // 挂号导航请求链接 @@ -40,6 +43,9 @@ public class MessagePushConfig { // 是否开启功能============================================ public static final boolean RECIPE_IS_ENABLE; + public static final String REG_AI_URL; + public static final boolean REG_AI_IS_ENABLE; + /** * 消息推送主链接 */ @@ -51,6 +57,8 @@ public class MessagePushConfig { static { ProperHelper config = new ProperHelper().read("message-push.properties"); + ORGANIZENAME = "4B80803106B38A5F"; + REG_NAVIGATE_IS_ENABLE = config.getBoolean("msg.reg.navigate.is_enable", false); REG_NAVIGATE_URL = config.getString("msg.reg.navigate.url"); // @@ -65,6 +73,9 @@ public class MessagePushConfig { RECIPE_IS_ENABLE = config.getBoolean("msg.recipe.is_enable", false); RECIPE_URL = config.getString("msg.recipe.url"); + REG_AI_IS_ENABLE = config.getBoolean("msg.ai.is_enable",false); + REG_AI_URL = config.getString("msg.ai.url"); + if (REG_CANCEL_URL == null) { log.error("【消息推送】配置文件message-push.properties读取失败"); } @@ -167,6 +178,73 @@ public class MessagePushConfig { } } + /** + * AI诊疗推送 + * @param merchantEnum + * @param reg + */ + public static void regAI(MerchantEnum merchantEnum,Register reg){ + try { + if (!merchantEnum.equals(MerchantEnum.WX) + || !REG_AI_IS_ENABLE || reg == null || ObjectUtils.isEmpty(REG_AI_URL)) { + return; + } + + log.info("[推送]AI智能问诊推送..."); + String patientId = reg.getPatientId(); + if ( patientId == null) { + log.warn("[推送]AI智能问诊推送通知失败,参数缺失~ patientId= null"); + return; + } + + RequestBody requestBody = new FormBody.Builder() + .add("patientId",patientId) + .add("content","为了帮助医生更全面地了解您的身体情况,请花2分钟时间填写病情信息,以便医生提前了解病症,为您提供更好的诊疗服务。") + .add("url", PWEHelper.getH5PWEUrl(patientId)) + .add("organizeName",ORGANIZENAME) + .build(); + OkHttpHelper.post(OBS_DOCUMENT, requestBody); + } catch (Exception e) { + log.warn("[推送]AI智能问诊推送通知错误-{}", e.getMessage()); + } + } + + + /** + * AI诊疗推送 + * @param patientId + */ + public static void regAIReport(String patientId){ + try { + if (!REG_AI_IS_ENABLE || ObjectUtils.isEmpty(REG_AI_URL)) { + return; + } + log.info("[推送]AI问诊报告推送..."); + if ( patientId == null) { + log.warn("[推送]AI问诊报告推送通知失败,参数缺失~ patientId= null"); + return; + } + + RequestBody requestBody = new FormBody.Builder() + .add("patientId",patientId) + .add("content","您好,您的预问诊报告可以查看啦") + .add("url", PWEHelper.getH5PWEUrl(patientId)) + .add("organizeName",ORGANIZENAME) + .build(); + OkHttpHelper.post(OBS_DOCUMENT, requestBody); + } catch (Exception e) { + log.warn("[推送]AI问诊报告推送通知错误-{}", e.getMessage()); + } + } + + + + + /** + * 红河州医院产科建党推送 + * @param merchantEnum + * @param reg + */ public static void regObsDocument(MerchantEnum merchantEnum, Register reg){ try { if (!merchantEnum.equals(MerchantEnum.WX) @@ -185,7 +263,7 @@ public class MessagePushConfig { .add("patientId",patientId) .add("content","[孕产建档提示]尊敬的孕妈妈您好!为了向您提供更好的服务,请点击下方链接完成孕产建档,若您已建档请忽略!") .add("url","https://zhck.hhzyy.com:10082/wxapp/") - .add("organizeName","4B80803106B38A5F") + .add("organizeName",ORGANIZENAME) .add("buttonName","进入产科建档系统") .build(); OkHttpHelper.post(OBS_DOCUMENT, requestBody); diff --git a/src/main/resources/message-push.properties b/src/main/resources/message-push.properties index b0071bc..183c6c6 100644 --- a/src/main/resources/message-push.properties +++ b/src/main/resources/message-push.properties @@ -15,3 +15,7 @@ msg.recipe.url=http://127.0.0.1:8123/MessagePlatform/paymentsuccess # 产科建档 msg.obs.document = http://127.0.0.1:8123/MessagePlatform/business/universal + + +msg.ai.is_enable = false +msg.ai.url = http://127.0.0.1:8123/MessagePlatform/business/universal