添加获取指定类型的消息记录接口;

This commit is contained in:
mengkuiliang 2023-10-25 17:23:00 +08:00
parent dc1b4c681e
commit 6f499cd4a5
12 changed files with 139 additions and 13 deletions

View File

@ -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全部人群")

View File

@ -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<String> deleteMegs(@RequestBody List<Long> ids) {

View File

@ -14,7 +14,7 @@ import lombok.Data;
@ApiModel("标记为已读传输对象")
public class MarkReadDto {
@ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询")
@ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知")
private String messageCategory;
@ApiModelProperty("绑定编号")

View File

@ -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;

View File

@ -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全部人群")

View File

@ -18,6 +18,15 @@ public interface ChatRecordMapper {
List<MessageVo> selectMegVoList(MessageSearchDto messageDto);
/**
* @Author mengkuiliang
* @Description
* @Date 2023-10-25 025 15:25
* @Param [bindingNo, doctorNo]
* @return com.xinelu.applet.vo.chatrecord.MessageCenterVo
**/
List<MessageVo> selectMegList(MessageSearchDto messageDto);
MessageCenterVo selectOneChatRecord(@Param("bindingNo")Long bindingNo, @Param("doctorNo")Long doctorNo);
/**
* 查询图文咨询-聊天记录

View File

@ -81,6 +81,15 @@ public interface IChatRecordService {
List<MessageCenterVo> getMegVoList(MessageSearchDto messageDto);
/**
* @Author mengkuiliang
* @Description 获取指定类型的消息记录
* @Date 2023-10-25 025 15:22
* @Param [messageDto]
* @return java.util.List<com.xinelu.applet.vo.chatrecord.MessageVo>
**/
List<MessageVo> getMegList(MessageSearchDto messageDto);
Integer deleteMegs(List<Long> ids);

View File

@ -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<com.xinelu.applet.vo.chatrecord.MessageVo>
**/
@Override
public List<MessageVo> 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<Long> ids) {
return chatRecordMapper.deleteMegs(ids);
}

View File

@ -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全部人群")

View File

@ -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全部人群")

View File

@ -78,6 +78,42 @@
order by send_time desc
</select>
<select id="selectMegList" resultType="com.xinelu.applet.vo.chatrecord.MessageVo">
select <include refid="Message_Vo_List"/>
from chat_record
where del_flag = '0' and message_category = #{messageCategory}
<!-- 查询居民注册之后的通知消息 -->
<if test="bindingTime != null">
and send_time &gt;= #{bindingTime}
</if>
<choose>
<!-- 健康推送 -->
<when test="messageCategory == 2">
and recipient_id is null
<!-- 查询适用人群的通知消息 -->
<if test="crowdNoList != null and crowdNoList.size() > 0">
and (
<foreach collection="crowdNoList" item="no" open="(" separator="or" close=")">
FIND_IN_SET(#{no},crowds)
</foreach>
or crowds = '0')
</if>
<!-- 查询签约医生的通知 -->
and sender_id = #{senderId}
</when>
<!-- 通知公告 -->
<when test="messageCategory == 1">
and recipient_id is null
</when>
<!-- 消息通知 -->
<when test="messageCategory == 4">
and recipient_id = #{recipientId}
</when>
</choose>
order by send_time desc
</select>
<select id="selectOneChatRecord" parameterType="java.lang.String"
resultType="com.xinelu.applet.vo.chatrecord.MessageCenterVo">
select message_category,

View File

@ -563,7 +563,9 @@
birth_date,
personal_wechat_code_url,
disabling_condition,
disabling_reason
disabling_reason,
city_code,
binding_time
FROM patient_info
WHERE id = #{id}
and del_flag = 0