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> + * + * @param objectList + * @param + * @return + * @throws Exception + */ + public static List> objectList2ListMap(List objectList) throws Exception { + ArrayList> resultList = new ArrayList<>(); + Map map = new HashMap<>(); + for (T t : objectList) { + resultList.add(object2Map(t)); + } + return resultList; + } + + /** + * List --> Map> + * + * @param objectList + * @param keyName + * @param + * @return + * @throws Exception + */ + public static Map> objectList2MapList(List objectList, String[] keyName) throws Exception { + Map> resultMap = new HashMap<>(); + for (int i = 0; i < keyName.length; i++) { + List arrayList = new ArrayList<>(); + // List有序,所以对每个对象依次变为map,然后得到对应的值,存入arrayList + for (T t : objectList) { + arrayList.add(object2Map(t).get(keyName[i])); + } + resultMap.put(keyName[i], arrayList);//将keyName和对应List集合存入resultMap + } + return resultMap; + } +} diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java index 52ccda4..6374006 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java @@ -16,9 +16,9 @@ import lombok.Data; public class MessagePushBody { /** - * 业务类型(1: 预约申请通知 2: 审批结果通知 3:用药提醒通知) + * 业务类型(1: 默认 9:申请 10:用药提醒通知) */ - @ApiModelProperty(value = "务类型(1: 预约申请通知 2: 审批结果通知 3:用药提醒通知)") + @ApiModelProperty(value = "务类型(1: 家医默认通知 10:申请通知 9:用药提醒通知)") private String busType; /** @@ -39,11 +39,40 @@ public class MessagePushBody { @ApiModelProperty(value = "发送标题") private String sendTitle; + /** + * 发送内容 + */ + @ApiModelProperty(value = "发送内容") + private String sendContent; + /** * 发送时间(yyyy-MM-dd HH:mm:ss) */ @ApiModelProperty(value = "发送时间(yyyy-MM-dd HH:mm:ss)") private String sendTime; + /** + * 接收人 + */ + @ApiModelProperty(value = "接收人") + private String receiveName; + + /** + * 发送内容1 + */ + @ApiModelProperty(value = "发送内容1") + private String text1; + + /** + * 发送内容2 + */ + @ApiModelProperty(value = "发送内容2") + private String text2; + + /** + * 发送内容3 + */ + @ApiModelProperty(value = "发送内容3") + private String text3; } diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java new file mode 100644 index 0000000..f9532ce --- /dev/null +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java @@ -0,0 +1,63 @@ +package com.xinelu.familydoctor.applet.pojo.dto; + +import com.xinelu.familydoctor.applet.pojo.dto.FDMessageExtentDto; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author mengkuiliang + * @Description 发家医送订阅消息传输对象 + * @Date 2023-10-19 019 10:14 + * @Param + * @return + **/ +@ApiModel("发家医送订阅消息传输对象") +@Data +public class FDMessageDto extends FDMessageExtentDto { + + @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询") + private String messageCategory; + + @ApiModelProperty("通知适用人群(0:全部人群)") + private String crowds; + + @ApiModelProperty(value = "发送人编号", required = true) + private String senderNo; + + @ApiModelProperty("发送人身份证号") + private String senderIdentity; + + @ApiModelProperty("发送人姓名") + private String senderName; + + @ApiModelProperty(value = "发送时间(yyyy-MM-dd HH:mm:ss)", hidden = true) + private String sendTime; + + @ApiModelProperty(value = "接收人编号") + private String recipientNo; + + @ApiModelProperty("接收人身份证号") + private String recipientIdentity; + + @ApiModelProperty("接收人姓名") + private String recipientName; + + @ApiModelProperty("消息类型,1:健康推送,2:日常提醒, 3:风险评估完成, 4:推送筛查项目,5:预约筛查成功, 6:筛查完成,7:康复处方,8:随访提醒,9:纳入管理,10:申请转诊,11:转诊申请通过,12:申请会诊,13:会诊申请通过,14:处理异常") + private String messageType; + + @ApiModelProperty("标题") + private String title; + + @ApiModelProperty("消息内容") + private String content; + + @ApiModelProperty("消息内容Id用于点击跳转") + private String contentId; + + @ApiModelProperty("消息来源") + private String source; + + @ApiModelProperty(value = "模版类型(MessageTemplateType枚举)", required = true) + private String templateType; +} diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageExtentDto.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageExtentDto.java new file mode 100644 index 0000000..ce505f0 --- /dev/null +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageExtentDto.java @@ -0,0 +1,43 @@ +package com.xinelu.familydoctor.applet.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author mengkuiliang + * @Description 家医订阅消息请求参数扩展类 + * @Date 2023-10-19 019 10:15 + * @Param + * @return + **/ +@Data +public class FDMessageExtentDto { + + @ApiModelProperty("居民姓名") + private String residentName; + + @ApiModelProperty("医院名称") + private String hospitalName; + + @ApiModelProperty("医生名称") + private String doctorName; + + @ApiModelProperty("团队名称") + private String teamName; + + @ApiModelProperty("申请内容(比如:申请签约、申请随访、申请转诊等)") + private String applyContent; + + @ApiModelProperty("申请结果(比如:成功、失败、处理中等)") + private String applyResult; + + @ApiModelProperty("处理时间") + private String handleDate; + + @ApiModelProperty("药品名称") + private String drugName; + + @ApiModelProperty("药品用法") + private String drugUsage; + +} diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/vo/ResidentServiceApplyVo.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/vo/ResidentServiceApplyVo.java index 23890ba..ddaccc5 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/vo/ResidentServiceApplyVo.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/vo/ResidentServiceApplyVo.java @@ -155,4 +155,39 @@ public class ResidentServiceApplyVo { @ApiModelProperty("签约编号") private String signNo; + /** + * 预约机构编号 + */ + @ApiModelProperty(value = "预约机构编号", required = true) + private String orgNo; + + /** + * 预约机构名称 + */ + @ApiModelProperty(value = "预约机构名称", required = true) + private String orgName; + + /** + * 预约团队编号 + */ + @ApiModelProperty(value = "预约团队编号", required = true) + private String teamNo; + + /** + * 预约团队名称 + */ + @ApiModelProperty(value = "预约团队名称", required = true) + private String teamName; + + /** + * 预约医生编号 + */ + @ApiModelProperty(value = "预约医生编号", required = true) + private String userNo; + + /** + * 预约医生姓名 + */ + @ApiModelProperty(value = "预约医生姓名", required = true) + private String userName; } diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java index ebf8ada..9ec3cfa 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java @@ -1,11 +1,14 @@ package com.xinelu.familydoctor.applet.service.impl; +import com.alibaba.fastjson2.JSONObject; +import com.xinelu.applet.service.messagepush.MessagePushService; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.familydoctor.applet.mapper.ResidentRescindApplyMapper; import com.xinelu.familydoctor.applet.pojo.body.ApprovalBody; +import com.xinelu.familydoctor.applet.pojo.body.MessagePushBody; import com.xinelu.familydoctor.applet.pojo.body.ResidentRescindApplyBody; import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo; import com.xinelu.familydoctor.applet.pojo.entity.ResidentRescindApplyEntity; @@ -34,6 +37,8 @@ public class ResidentRescindApplyServiceImpl implements IResidentRescindApplySer private ResidentRescindApplyMapper residentRescindApplyMapper; @Resource private IResidentPatientInfoService patientInfoService; + @Resource + private MessagePushService messagePushService; @Override public List findList(ApplyQuery query) { @@ -61,11 +66,11 @@ public class ResidentRescindApplyServiceImpl implements IResidentRescindApplySer ResidentRescindApplyEntity entity = new ResidentRescindApplyEntity(); BeanUtils.copyProperties(body, entity); + PatientInfo patientInfo = patientInfoService.getByCardNo(body.getIdentity()); + if (patientInfo == null) { + throw new ServiceException("未查询到注册信息"); + } if(StringUtils.isBlank(body.getPatientId())) { - PatientInfo patientInfo = patientInfoService.getByCardNo(body.getIdentity()); - if (patientInfo == null) { - throw new ServiceException("未查询到注册信息"); - } entity.setPatientId(patientInfo.getPatientCode()); } @@ -74,6 +79,16 @@ public class ResidentRescindApplyServiceImpl implements IResidentRescindApplySer entity.setBookingStatus("0"); entity.setApprovalStatus("0"); residentRescindApplyMapper.insert(entity); + + MessagePushBody messagePushBody = new MessagePushBody(); + messagePushBody.setBusType("10"); + messagePushBody.setOpenid(patientInfo.getOpenid()); + messagePushBody.setReceiveName(patientInfo.getPatientName()); + messagePushBody.setText1(body.getOrgName()); + messagePushBody.setText2("解约申请"); + messagePushBody.setSendTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())); + messagePushBody.setSendContent(patientInfo.getPatientName() + "已提交申请"); + messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(messagePushBody))); } /** diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java index 388feea..94f3567 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java @@ -2,6 +2,7 @@ package com.xinelu.familydoctor.applet.service.impl; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.xinelu.applet.service.messagepush.MessagePushService; import com.xinelu.common.core.domain.R; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.DateUtils; @@ -11,6 +12,7 @@ import com.xinelu.common.utils.spring.SpringUtils; import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.familydoctor.applet.mapper.ResidentServiceApplyMapper; import com.xinelu.familydoctor.applet.pojo.body.ApprovalBody; +import com.xinelu.familydoctor.applet.pojo.body.MessagePushBody; import com.xinelu.familydoctor.applet.pojo.body.ResidentServiceApplyBody; import com.xinelu.familydoctor.applet.pojo.dto.ResidentServiceFormApplyDto; import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo; @@ -49,6 +51,8 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe private IHospitalInfoService hospitalInfoService; @Resource private IScreeningProjectService screeningProjectService; + @Resource + private MessagePushService messagePushService; /** * 新增服务申请 @@ -64,22 +68,20 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe applyQuery.setIdentity(body.getIdentity()); applyQuery.setBookingStatus("0"); applyQuery.setApprovalStatus("0"); + applyQuery.setFormNo(body.getFormNo()); List serviceBookingInfoVoList = residentServiceApplyMapper.findByBody(applyQuery); if (serviceBookingInfoVoList != null && serviceBookingInfoVoList.size() > 0) { - throw new ServiceException("已经提交服务申请,不能重复提交"); + throw new ServiceException("已提交该服务申请,不能重复提交"); } ResidentServiceApplyEntity entity; - PatientInfo patientInfo = null; - if (StringUtils.isBlank(body.getPatientId())) { - patientInfo = patientInfoService.getByCardNo(body.getIdentity()); - if (patientInfo == null) { - throw new ServiceException("未查询到注册信息"); - } + PatientInfo patientInfo = patientInfoService.getByCardNo(body.getIdentity()); + if (patientInfo == null) { + throw new ServiceException("未查询到注册信息"); } entity = new ResidentServiceApplyEntity(); BeanUtils.copyProperties(body, entity); - if (patientInfo != null) { + if (StringUtils.isBlank(entity.getPatientId())) { entity.setPatientId(patientInfo.getPatientCode()); } entity.setApplyTime(new Date()); @@ -92,6 +94,16 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe entity.setServiceWay("2"); } residentServiceApplyMapper.insert(entity); + + MessagePushBody messagePushBody = new MessagePushBody(); + messagePushBody.setBusType("10"); + messagePushBody.setOpenid(patientInfo.getOpenid()); + messagePushBody.setReceiveName(patientInfo.getPatientName()); + messagePushBody.setText1(body.getOrgName()); + messagePushBody.setText2(body.getFormName().length() >= 20? body.getFormName().substring(0,17) + "...": body.getFormName()); + messagePushBody.setSendTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())); + messagePushBody.setSendContent(patientInfo.getPatientName() + "已提交服务申请"); + messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(messagePushBody))); } /** @@ -286,6 +298,10 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe sp.setDiscountPrice(per.getPackSignCost()); sp.setServiceFreq(per.getServiceFreq()); sp.setPerformanceCount(per.getPerformanceCount()); + sp.setTeamNo(per.getTeamNo()); + sp.setTeamName(per.getTeamName()); + sp.setUserNo(per.getUserNo()); + sp.setUserName(per.getUserName()); projectList.add(sp); } } diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java index 0c6a1f9..c65aa18 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java @@ -1,6 +1,7 @@ package com.xinelu.familydoctor.applet.service.impl; import com.alibaba.fastjson2.JSONObject; +import com.xinelu.applet.service.messagepush.MessagePushService; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.StringUtils; @@ -9,6 +10,7 @@ import com.xinelu.common.utils.spring.SpringUtils; import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.familydoctor.applet.mapper.ResidentSignApplyMapper; import com.xinelu.familydoctor.applet.pojo.body.ApprovalBody; +import com.xinelu.familydoctor.applet.pojo.body.MessagePushBody; import com.xinelu.familydoctor.applet.pojo.body.ResidentSignApplyBody; import com.xinelu.familydoctor.applet.pojo.dto.CrowdDto; import com.xinelu.familydoctor.applet.pojo.dto.PackageDto; @@ -45,6 +47,8 @@ public class ResidentSignApplyServiceImpl implements IResidentSignAppletService private HttpService httpService; @Resource private IResidentPatientInfoService patientInfoService; + @Resource + private MessagePushService messagePushService; /** * 新增签约申请 @@ -67,11 +71,11 @@ public class ResidentSignApplyServiceImpl implements IResidentSignAppletService ResidentSignApplyEntity entity = new ResidentSignApplyEntity(); BeanUtils.copyProperties(body, entity); + PatientInfo patientInfo = patientInfoService.getByCardNo(body.getIdentity()); + if (patientInfo == null) { + throw new ServiceException("未查询到注册信息"); + } if(StringUtils.isBlank(body.getPatientId())) { - PatientInfo patientInfo = patientInfoService.getByCardNo(body.getIdentity()); - if (patientInfo == null) { - throw new ServiceException("未查询到注册信息"); - } entity.setPatientId(patientInfo.getPatientCode()); } @@ -92,6 +96,16 @@ public class ResidentSignApplyServiceImpl implements IResidentSignAppletService entity.setPackagesNo(body.getPackageList().stream().map(PackageDto::getPackageNo).collect(Collectors.joining(","))); entity.setPackagesName(body.getPackageList().stream().map(PackageDto::getPackageName).collect(Collectors.joining(","))); residentSignApplyMapper.insert(entity); + + MessagePushBody messagePushBody = new MessagePushBody(); + messagePushBody.setBusType("10"); + messagePushBody.setOpenid(patientInfo.getOpenid()); + messagePushBody.setReceiveName(body.getResidentName()); + messagePushBody.setText1(body.getOrgName()); + messagePushBody.setText2("签约申请"); + messagePushBody.setSendTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())); + messagePushBody.setSendContent(body.getResidentName() + "已提交申请"); + messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(messagePushBody))); } /** diff --git a/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentRescindApplyMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentRescindApplyMapper.xml index 1eb9b2e..4a030e8 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentRescindApplyMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentRescindApplyMapper.xml @@ -34,7 +34,7 @@ approval_status,refuse_reason,approval_time - p.id,p.apply_no,p.patient_id,sign_no,p.identity, + p.id,p.apply_no,p.patient_id,p.sign_no,p.identity, p.org_no,p.org_name,p.team_no, p.team_name,p.user_no,p.user_name, p.apply_time,booking_status,cancel_time,p.rescind_type,p.rescind_reason, diff --git a/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentServiceApplyMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentServiceApplyMapper.xml index ed35592..31515e7 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentServiceApplyMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/sign/ResidentServiceApplyMapper.xml @@ -176,6 +176,8 @@ remark, + service_way, + #{bookingNo}, @@ -186,9 +188,9 @@ #{identity}, - #{packagesNo}, + #{packageNo}, - #{packagesName}, + #{packageName}, #{formNo}, @@ -222,6 +224,8 @@ #{remark}, + #{serviceWay}, + @@ -252,7 +256,7 @@