From 6f499cd4a55513727bfc69f068d7ff86ae03a6e9 Mon Sep 17 00:00:00 2001 From: mengkuiliang <1464081137@qq.com> Date: Wed, 25 Oct 2023 17:23:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E7=B1=BB=E5=9E=8B=E7=9A=84=E6=B6=88=E6=81=AF=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applet/pojo/dto/FDMessageDto.java | 2 +- .../chatrecord/ChatRecordController.java | 16 +++++ .../applet/dto/chatrecord/MarkReadDto.java | 2 +- .../dto/chatrecord/MessageSearchDto.java | 4 +- .../dto/messagepush/FDMessagePushDto.java | 2 +- .../mapper/chatrecord/ChatRecordMapper.java | 9 +++ .../chatRecord/IChatRecordService.java | 9 +++ .../impl/ChatRecordServiceImpl.java | 64 +++++++++++++++++-- .../applet/vo/chatrecord/MessageCenterVo.java | 2 +- .../applet/vo/chatrecord/MessageVo.java | 2 +- .../applet/chatrecord/ChatRecordMapper.xml | 36 +++++++++++ .../manage/patientinfo/PatientInfoMapper.xml | 4 +- 12 files changed, 139 insertions(+), 13 deletions(-) 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 index 8e17161..5919e50 100644 --- 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 @@ -16,7 +16,7 @@ import lombok.Data; @Data public class FDMessageDto extends FDMessageExtentDto { - @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询") + @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; @ApiModelProperty("通知适用人群(0:全部人群)") diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java index 6b80fdd..81c117c 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java @@ -4,12 +4,15 @@ import com.xinelu.applet.dto.chatrecord.ChatRecordDTO; import com.xinelu.applet.dto.chatrecord.MessageSearchDto; import com.xinelu.applet.service.chatRecord.IChatRecordService; import com.xinelu.applet.vo.chatrecord.MessageCenterVo; +import com.xinelu.applet.vo.chatrecord.MessageVo; import com.xinelu.common.annotation.Log; import com.xinelu.common.constant.Constants; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.R; +import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.enums.BusinessType; +import com.xinelu.common.exception.ServiceException; import com.xinelu.common.socket.WebSocketUtils; import com.xinelu.manage.domain.chatRecord.ChatRecord; import io.swagger.annotations.Api; @@ -101,6 +104,19 @@ public class ChatRecordController extends BaseController { return R.ok(chatRecordService.getMegVoList(messageDto)); } + @ApiOperation(value = "获取指定类型的消息记录", notes = "1:通知公告 2:健康推送 4:消息通知") + @GetMapping("/getMegList") + public TableDataInfo getMegList(MessageSearchDto messageDto) { + if (messageDto.getPatientId() == null) { + throw new ServiceException("居民业务主键不能为空"); + } + if (StringUtils.isBlank(messageDto.getMessageCategory())) { + throw new ServiceException("消息类型不能为空"); + } + startPage(); + return getDataTable(chatRecordService.getMegList(messageDto)); + } + @ApiOperation("删除消息") @GetMapping("/deleteMegs") public R deleteMegs(@RequestBody List ids) { diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java index a56809c..08a910e 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java @@ -14,7 +14,7 @@ import lombok.Data; @ApiModel("标记为已读传输对象") public class MarkReadDto { - @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询") + @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; @ApiModelProperty("绑定编号") diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java index c85521e..c63a489 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java @@ -14,14 +14,14 @@ import lombok.Data; @Data public class MessageSearchDto { - @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询") + @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; @ApiModelProperty("通知适用人群(0:全部人群)") private String crowds; @ApiModelProperty(value = "居民注册业务主键") - private String bindingNo; + private Long patientId; @ApiModelProperty("发送人编号") private Long senderId; diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java index c8f6f6f..8885af9 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java @@ -18,7 +18,7 @@ public class FDMessagePushDto extends FDMessageExtentDto{ @ApiModelProperty("业务主键") private String messageNo; - @ApiModelProperty(value = "消息类别 1:通知公告,2:健康推送,3:在线咨询", required = true) + @ApiModelProperty(value = "消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知", required = true) private String messageCategory; @ApiModelProperty("通知适用人群(0:全部人群)") diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java index 484f981..68551d2 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java @@ -18,6 +18,15 @@ public interface ChatRecordMapper { List selectMegVoList(MessageSearchDto messageDto); + /** + * @Author mengkuiliang + * @Description + * @Date 2023-10-25 025 15:25 + * @Param [bindingNo, doctorNo] + * @return com.xinelu.applet.vo.chatrecord.MessageCenterVo + **/ + List selectMegList(MessageSearchDto messageDto); + MessageCenterVo selectOneChatRecord(@Param("bindingNo")Long bindingNo, @Param("doctorNo")Long doctorNo); /** * 查询图文咨询-聊天记录 diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java index dadd924..77fbc76 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java @@ -81,6 +81,15 @@ public interface IChatRecordService { List getMegVoList(MessageSearchDto messageDto); + /** + * @Author mengkuiliang + * @Description 获取指定类型的消息记录 + * @Date 2023-10-25 025 15:22 + * @Param [messageDto] + * @return java.util.List + **/ + List getMegList(MessageSearchDto messageDto); + Integer deleteMegs(List ids); diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java index 2df83dd..83363db 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java @@ -1,5 +1,6 @@ package com.xinelu.applet.service.chatRecord.impl; +import com.alibaba.fastjson2.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.xinelu.applet.dto.chatrecord.ChatRecordDTO; @@ -10,6 +11,7 @@ import com.xinelu.applet.vo.chatrecord.MessageCenterVo; import com.xinelu.applet.vo.chatrecord.MessageVo; import com.xinelu.common.config.XinELuConfig; import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.domain.R; import com.xinelu.common.core.dto.MessageTemplate; import com.xinelu.common.enums.MessageContentType; import com.xinelu.common.exception.ServiceException; @@ -19,19 +21,20 @@ import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.file.FileUploadUtils; import com.xinelu.common.utils.file.MimeTypeUtils; +import com.xinelu.common.utils.http.HttpService; +import com.xinelu.common.utils.spring.SpringUtils; import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.manage.domain.chatRecord.ChatRecord; import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.time.ZoneId; +import java.util.*; import java.util.stream.Collectors; import javax.annotation.Resource; import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService; +import com.xinelu.manage.service.patientinfo.IPatientInfoService; +import com.xinelu.manage.vo.patientinfo.PatientInfoVO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -51,6 +54,10 @@ public class ChatRecordServiceImpl implements IChatRecordService { private XinELuConfig xinYiLuConfig; @Resource private IHospitalPersonInfoService hospitalPersonInfoService; + @Resource + private IPatientInfoService patientInfoService; + @Resource + private HttpService httpService; /** * 查询图文咨询-聊天记录 @@ -224,6 +231,53 @@ public class ChatRecordServiceImpl implements IChatRecordService { return messageCenterVos; } + /** + * @Author mengkuiliang + * @Description 获取指定类型的消息记录 + * @Date 2023-10-25 025 15:21 + * @Param [messageDto] + * @return java.util.List + **/ + @Override + public List getMegList(MessageSearchDto messageDto) { + // 获取注册信息 + PatientInfoVO patientInfo = patientInfoService.selectPatientInfoById(messageDto.getPatientId()); + if (patientInfo == null) { + throw new ServiceException("未查询到注册信息"); + } + String bindTimeStr = String.valueOf(patientInfo.getBindingTime().getYear()) + String.valueOf(patientInfo.getBindingTime().getMonthValue()) + String.valueOf(patientInfo.getBindingTime().getDayOfMonth()) + String.valueOf(patientInfo.getBindingTime().getHour()) + String.valueOf(patientInfo.getBindingTime().getMinute()) + String.valueOf(patientInfo.getBindingTime().getSecond()); + messageDto.setBindingTime(DateUtils.parseDate(bindTimeStr)); + + // 通知公告 + if(messageDto.getMessageCategory().equals("1")) { + return chatRecordMapper.selectMegList(messageDto); + // 健康推送 + } else if(messageDto.getMessageCategory().equals("2")) { + String result = (String) httpService.get(SpringUtils.getFdUrl(patientInfo.getCityCode()) + "/resident/signinfo/detail/" + patientInfo.getCardNo(), null, String.class); + JSONObject jsonObject = JSONObject.parseObject(result); + if (!"1".equals(jsonObject.get("code"))) { + throw new ServiceException(jsonObject.get("msg").toString()); + } + if (!jsonObject.containsKey("data") || jsonObject.get("data") == null) { + throw new ServiceException("未查询到签约信息"); + } + JSONObject signInfoObject = jsonObject.getJSONObject("data"); + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(signInfoObject.getString("userNo"), null); + if (hospitalPersonInfo == null) { + throw new ServiceException("未查询到医生信息"); + } + messageDto.setSenderId(hospitalPersonInfo.getId()); + messageDto.setCrowdNoList(Arrays.asList(signInfoObject.getString("crowdsNo").split(","))); + return chatRecordMapper.selectMegList(messageDto); + // 消息通知 + } else if(messageDto.getMessageCategory().equals("4")) { + messageDto.setRecipientId(patientInfo.getId()); + return chatRecordMapper.selectMegList(messageDto); + } else { + return new ArrayList<>(); + } + } + @Override public Integer deleteMegs(List ids) { return chatRecordMapper.deleteMegs(ids); } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java index 4cdbb0f..dda4074 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java @@ -15,7 +15,7 @@ import lombok.Data; @Data public class MessageCenterVo { - @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询") + @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; @ApiModelProperty("通知适用人群(0:全部人群)") diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java index d495ee3..a5a401e 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java @@ -18,7 +18,7 @@ public class MessageVo { @ApiModelProperty("业务主键") private String messageNo; - @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询") + @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; @ApiModelProperty("通知适用人群(0:全部人群)") diff --git a/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml b/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml index 2659791..7ef99ca 100644 --- a/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml +++ b/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml @@ -78,6 +78,42 @@ order by send_time desc + + +