From 3775e9ca7e55ec2182439b01990675c4a6fc1e5e Mon Sep 17 00:00:00 2001
From: mengkuiliang <1464081137@qq.com>
Date: Fri, 20 Oct 2023 10:41:06 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E5=AE=B6=E5=8C=BB?=
=?UTF-8?q?=E5=8F=91=E9=80=81=E5=BE=AE=E4=BF=A1=E8=AE=A2=E9=98=85=E6=B6=88?=
=?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3=EF=BC=9B=202=E3=80=81=E7=AD=BE?=
=?UTF-8?q?=E7=BA=A6=E5=AE=A1=E6=A0=B8=E3=80=81=E8=A7=A3=E7=BA=A6=E5=AE=A1?=
=?UTF-8?q?=E6=A0=B8=E3=80=81=E6=9C=8D=E5=8A=A1=E7=94=B3=E8=AF=B7=E3=80=81?=
=?UTF-8?q?=E7=AD=9B=E6=9F=A5=E9=A1=B9=E7=9B=AE=E9=A2=84=E7=BA=A6=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E5=BE=AE=E4=BF=A1=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF?=
=?UTF-8?q?=E6=8F=90=E9=86=92=EF=BC=9B=203=E3=80=81=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E5=85=B6=E4=BB=96=E9=97=AE=E9=A2=98=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
xinelu-admin/pom.xml | 4 -
.../applet/FdMessageController.java | 80 +++++++++++
.../ResidentServiceApplyController.java | 10 +-
.../controller/applet/SignInfoController.java | 3 +
.../src/main/resources/application.yml | 2 +-
.../common/config/AppletChatConfig.java | 15 --
.../common/enums/MessageTemplateType.java | 79 +++++++++++
.../xinelu/common/enums/MessageTypePath.java | 45 ++++++
.../com/xinelu/common/utils/map/MapUtil.java | 72 ++++++++++
.../applet/pojo/body/MessagePushBody.java | 33 ++++-
.../applet/pojo/dto/FDMessageDto.java | 63 +++++++++
.../applet/pojo/dto/FDMessageExtentDto.java | 43 ++++++
.../pojo/vo/ResidentServiceApplyVo.java | 35 +++++
.../impl/ResidentRescindApplyServiceImpl.java | 23 +++-
.../impl/ResidentServiceApplyServiceImpl.java | 32 +++--
.../impl/ResidentSignApplyServiceImpl.java | 22 ++-
.../sign/ResidentRescindApplyMapper.xml | 2 +-
.../sign/ResidentServiceApplyMapper.xml | 13 +-
.../AppletScreeningRecordController.java | 11 +-
.../dto/messagepush/FDMessageExtentDto.java | 43 ++++++
.../dto/messagepush/FDMessagePushDto.java | 66 +++++++++
.../applet/dto/messagepush/FDWxMegDto.java | 35 +++++
.../applet/dto/messagepush/TemplateData.java | 17 +++
.../Impl/MessagePushServiceImpl.java | 130 ++++++++++++++----
.../messagepush/MessagePushService.java | 10 ++
.../IScreeningRecordService.java | 2 +-
.../impl/ScreeningRecordServiceImpl.java | 30 ++--
27 files changed, 830 insertions(+), 90 deletions(-)
create mode 100644 xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
create mode 100644 xinelu-common/src/main/java/com/xinelu/common/enums/MessageTemplateType.java
create mode 100644 xinelu-common/src/main/java/com/xinelu/common/enums/MessageTypePath.java
create mode 100644 xinelu-common/src/main/java/com/xinelu/common/utils/map/MapUtil.java
create mode 100644 xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java
create mode 100644 xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageExtentDto.java
create mode 100644 xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessageExtentDto.java
create mode 100644 xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java
create mode 100644 xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDWxMegDto.java
create mode 100644 xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/TemplateData.java
diff --git a/xinelu-admin/pom.xml b/xinelu-admin/pom.xml
index 605eede..e5f351f 100644
--- a/xinelu-admin/pom.xml
+++ b/xinelu-admin/pom.xml
@@ -79,10 +79,6 @@
com.xinelu
xinelu-nurse-applet
-
- com.xinelu
- xinelu-familydoctor
-
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
new file mode 100644
index 0000000..a7a287a
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
@@ -0,0 +1,80 @@
+package com.xinelu.web.controller.applet;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.xinelu.applet.service.messagepush.MessagePushService;
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.R;
+import com.xinelu.familydoctor.applet.pojo.body.MessagePushBody;
+import com.xinelu.familydoctor.applet.pojo.dto.FDMessageDto;
+import com.xinelu.familydoctor.applet.pojo.vo.SignInfoDataVo;
+import com.xinelu.framework.config.AsyncExecutorConfig;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+
+/**
+ * @Author mengkuiliang
+ * @Description 家医消息推送控制器
+ * @Date 2023-10-19 019 11:18
+ * @Param
+ * @return
+ **/
+@Api(tags = "家医消息推送控制器")
+@RestController
+@RequestMapping("/applet/message")
+public class FdMessageController extends BaseController {
+ @Resource
+ private MessagePushService messagePushService;
+ @Resource
+ private AsyncExecutorConfig asyncExecutorConfig;
+
+ @ApiOperation(value = "家医推送订阅消息", notes = "向接收方推送订阅消息")
+ @PostMapping("/push")
+ public R pushMessage(@RequestBody FDMessageDto message) throws Exception {
+ if (StringUtils.isBlank(message.getRecipientIdentity())) {
+ return R.fail("接收方参数异常");
+ }
+ if (StringUtils.isBlank(message.getTemplateType())) {
+ return R.fail("消息模版参数异常");
+ }
+ messagePushService.FdPushMessage(JSONObject.parseObject(JSONObject.toJSONString(message)));
+ return R.ok();
+ }
+
+ @ApiOperation(value = "测试接口")
+ @GetMapping("/test/")
+ public R test(MessagePushBody body, @RequestHeader("region") String region) {
+// JSONObject jsonObject = null;
+// try {
+// String result = (String) httpService.get(SpringUtils.getFdUrl(region) + "/resident/signinfo/detail/2334", null, String.class);
+// jsonObject = JSONObject.parseObject(result);
+// if ("0".equals(jsonObject.get("code"))) {
+// return R.fail(jsonObject.get("msg").toString());
+// }
+// if (!jsonObject.containsKey("data") || jsonObject.get("data") == null) {
+// return R.ok();
+// }
+// return R.ok(JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), SignInfoDataVo.class));
+// } catch (Exception e) {
+// System.out.println("注册完善信息-更新签约标识出错:" + e.getMessage());
+// }
+
+ ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ //设置子线程共享
+ RequestContextHolder.setRequestAttributes(servletRequestAttributes, true);
+ asyncExecutorConfig.asyncThreadServiceExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ System.out.println("发送消息");
+ messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(body)));
+ }
+ });
+ System.out.println("执行成功");
+ return R.ok();
+ }
+}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java
index 5f2ac67..628432c 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java
@@ -47,7 +47,7 @@ public class ResidentServiceApplyController extends BaseController {
@Resource
private IOrderEvaluateInfoService orderEvaluateInfoService;
- @ApiOperation("提交服务预约")
+ @ApiOperation("提交服务申请")
@PostMapping("/save")
public R> save(@RequestBody ResidentServiceApplyBody body) {
if (body == null || StringUtils.isBlank(body.getPackageNo()) || StringUtils.isBlank(body.getFormNo())) {
@@ -60,14 +60,14 @@ public class ResidentServiceApplyController extends BaseController {
return R.ok();
}
- @ApiOperation("取消服务预约")
+ @ApiOperation("取消服务申请")
@GetMapping("/cancel/{bookingNo}")
public R> cancel(@PathVariable String bookingNo) {
residentServiceAppletService.cancel(bookingNo);
return R.ok();
}
- @ApiOperation("服务预约列表")
+ @ApiOperation("服务申请列表")
@PostMapping("/list")
public TableDataInfo performanceBookingList(@RequestBody ApplyQuery query) {
if (StringUtils.isBlank(query.getIdentity())) {
@@ -82,13 +82,13 @@ public class ResidentServiceApplyController extends BaseController {
}
}
- @ApiOperation("服务预约详情")
+ @ApiOperation("服务申请详情")
@GetMapping("/detail/{bookingNo}")
public R performanceBookingDetail(@PathVariable String bookingNo) {
return R.ok(residentServiceAppletService.detail(bookingNo));
}
- @ApiOperation(value = "获取服务预约项目列表", notes = "获取家医个性服务包和筛查项目")
+ @ApiOperation(value = "获取服务申请项目列表", notes = "获取家医个性服务包和筛查项目")
@GetMapping("/getForm/{identity}")
public R> getForm(@PathVariable String identity, String projectName, @RequestHeader("region") String region) {
return R.ok(residentServiceAppletService.getForm(identity, projectName, region));
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java
index a4ec9c5..7d023fc 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java
@@ -2,6 +2,7 @@ package com.xinelu.web.controller.applet;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
+import com.xinelu.applet.service.messagepush.MessagePushService;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
@@ -13,6 +14,7 @@ import com.xinelu.familydoctor.applet.pojo.query.NearbyOrgQuery;
import com.xinelu.familydoctor.applet.pojo.query.PackageQuery;
import com.xinelu.familydoctor.applet.pojo.query.TeamListQuery;
import com.xinelu.familydoctor.applet.pojo.vo.*;
+import com.xinelu.framework.config.AsyncExecutorConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@@ -280,4 +282,5 @@ public class SignInfoController extends BaseController {
}
return R.ok(JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), SignInfoDataVo.class));
}
+
}
diff --git a/xinelu-admin/src/main/resources/application.yml b/xinelu-admin/src/main/resources/application.yml
index 14d25aa..9c42939 100644
--- a/xinelu-admin/src/main/resources/application.yml
+++ b/xinelu-admin/src/main/resources/application.yml
@@ -163,7 +163,7 @@ token:
# 令牌有效期(默认30分钟)
expireTime: 1440
#请求拦截白名单
- ant-matchers: /nurseApplet/**,/nurseApp/**,/applet/**,webSocket/**
+ ant-matchers: /nurseApplet/**,/nurseApp/**,/applet/**,webSocket/**,/message/**
# MyBatis-Plus配置
mybatis-plus:
diff --git a/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java b/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java
index 5ff0de3..f726231 100644
--- a/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java
+++ b/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java
@@ -65,19 +65,4 @@ public class AppletChatConfig {
*/
private String signTemplateId;
- /**
- * 家庭医生消息通知默认模版
- */
- private String fdMessageDefaultTempId;
-
- /**
- * 家庭医生预约成功通知模版
- */
- private String fdMessageApplyTempId;
-
- /**
- * 家庭医生用药提醒通知模版
- */
- private String fdMessageMedicineTempId;
-
}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTemplateType.java b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTemplateType.java
new file mode 100644
index 0000000..b1ba81c
--- /dev/null
+++ b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTemplateType.java
@@ -0,0 +1,79 @@
+package com.xinelu.common.enums;
+
+import lombok.Getter;
+
+import java.util.*;
+
+/**
+ * @Author mengkuiliang
+ * @Description 订阅消息枚举
+ * @Date 2023-01-11 17:32
+ * @Param
+ * @return
+ **/
+@Getter
+public enum MessageTemplateType {
+
+ JTYSXXTZ("1", "家庭医生消息通知", "8InV9jXDT5sMj9OWfXEvlLQGlw2UaWfZ9OBMFxufmfk", "默认通知模版"),
+
+ YYTX_1("9", "用药提醒", "2wn1BssReKjZasxKKZRWxBN0VqSmGmkuhc3AhTr18I0", "提醒居民用药"),
+
+ YYCGTZ("10", "预约成功", "MSSKCxOdtMUkY1ACu-u3itz8Vh_w5xDkO2llAOGwElU", "筛查项目预约成功");
+
+
+ /**
+ * 模版类型
+ */
+ private final String type;
+
+ /**
+ * 标题
+ */
+ private final String title;
+ /**
+ * 模版ID
+ */
+ private final String templateId;
+ /**
+ * 说明
+ */
+ private final String description;
+
+ MessageTemplateType(String type,String title, String templateId, String description) {
+ this.type = type;
+ this.title = title;
+ this.templateId = templateId;
+ this.description = description;
+ }
+
+ public static MessageTemplateType getFolllowupTypeByCode(String type) {
+ for (MessageTemplateType templateType : MessageTemplateType.values()) {
+ if (type.equals(templateType.getType())) {
+ return templateType;
+ }
+ }
+ return MessageTemplateType.JTYSXXTZ;
+ }
+
+
+ /**
+ * 获得所有枚举类型到list
+ */
+ public static List getAllToList() {
+ List list = new ArrayList<>();
+ MessageTemplateType[] values = values();
+ Collections.addAll(list, values);
+ return list;
+ }
+
+ /**
+ * 获得所有枚举类型到map
+ */
+ public static Map getAllToMap() {
+ Map map = new HashMap<>();
+ for (MessageTemplateType templateType : values()) {
+ map.put(templateType.getType(), templateType);
+ }
+ return map;
+ }
+}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTypePath.java b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTypePath.java
new file mode 100644
index 0000000..0f1a62c
--- /dev/null
+++ b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTypePath.java
@@ -0,0 +1,45 @@
+package com.xinelu.common.enums;
+
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * @Author haown
+ * @Description 订阅消息跳转路径枚举类
+ * @Date 2023-05-11 17:32
+ * @return
+ **/
+@Getter
+public enum MessageTypePath {
+ //消息类型,1:健康推送,2:日常提醒, 3:风险评估完成, 4:推送筛查项目,5:预约筛查成功, 6:筛查完成,
+ // 7:康复处方,8:随访提醒,9:纳入管理,10:申请转诊,11:转诊申请通过,12:申请会诊,13:会诊申请通过,14:处理异常"
+ JKTS("1", "pages/index/index"),
+ RCTX("2", "pages/dailyhealth/dailyhealth"),
+ FXPG("3", "pages/index/index"),
+ SCXM("4", "pagesB/screeningUserInfo/screeningUserInfo?assessRecordId="),
+ YYCG("5", "pages/index/index"),
+ SCWC("6", "pages/screeningResult/screeningResult?screeningId="),
+ KFCF("7", "pages/boughtRecoveryPrescription/boughtRecoveryPrescription?prescriptionRecordId="),
+ DEFAULT("0", "pages/index/index");
+
+ private final String messageType;
+
+ private final String path;
+
+ MessageTypePath(String messageType, String path) {
+ this.messageType = messageType;
+ this.path = path;
+ }
+
+ public static MessageTypePath getPathByType(String type) {
+ if(StringUtils.isBlank(type)) {
+ return MessageTypePath.DEFAULT;
+ }
+ for (MessageTypePath typePath : MessageTypePath.values()) {
+ if (type.equals(typePath.getMessageType())) {
+ return typePath;
+ }
+ }
+ return MessageTypePath.DEFAULT;
+ }
+}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/utils/map/MapUtil.java b/xinelu-common/src/main/java/com/xinelu/common/utils/map/MapUtil.java
new file mode 100644
index 0000000..fe5652c
--- /dev/null
+++ b/xinelu-common/src/main/java/com/xinelu/common/utils/map/MapUtil.java
@@ -0,0 +1,72 @@
+package com.xinelu.common.utils.map;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author mengkuiliang
+ * @Description Obj转Map
+ * @Date 2022-04-27 13:39
+ * @Param
+ * @return
+ **/
+public class MapUtil {
+ /**
+ * Pojo -> Map
+ *
+ * @param obj
+ * @return
+ * @throws Exception
+ */
+ public static Map object2Map(Object obj) throws Exception {
+ Map map = new HashMap();
+ Field[] fields = obj.getClass().getDeclaredFields();
+ for (Field field : fields) {
+ field.setAccessible(true);
+ map.put(field.getName(), field.get(obj));
+ }
+ return map;
+ }
+
+ /**
+ * List --> List