Merge branch 'jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' of http://182.92.166.109:3000/jihan/xinelu-api into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支

This commit is contained in:
mengkuiliang 2023-11-10 17:37:57 +08:00
commit b8449df3bb
21 changed files with 519 additions and 127 deletions

View File

@ -48,6 +48,7 @@ public class AppletScreeningProjectController extends BaseController {
project.setProjectName(groupByProject.get(projectId).get(0).getProjectName()); project.setProjectName(groupByProject.get(projectId).get(0).getProjectName());
project.setHospitalId(groupByProject.get(projectId).get(0).getHospitalId()); project.setHospitalId(groupByProject.get(projectId).get(0).getHospitalId());
project.setHospitalName(groupByProject.get(projectId).get(0).getHospitalName()); project.setHospitalName(groupByProject.get(projectId).get(0).getHospitalName());
project.setCreateTime(groupByProject.get(projectId).get(0).getApplyStartTime());
projectList.add(project); projectList.add(project);
} }
} }

View File

@ -1,9 +1,5 @@
package com.xinelu.applet.controller.chatrecord; package com.xinelu.applet.controller.chatrecord;
import com.xinelu.manage.dto.chatrecord.ChatRecordDTO;
import com.xinelu.manage.dto.chatrecord.MessageSearchDto;
import com.xinelu.manage.service.chatrecord.IChatRecordService;
import com.xinelu.manage.vo.chatrecord.MessageCenterVo;
import com.xinelu.common.constant.Constants; import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.AjaxResult;
@ -12,15 +8,29 @@ import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.exception.ServiceException; import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.socket.WebSocketUtils; import com.xinelu.common.socket.WebSocketUtils;
import com.xinelu.manage.domain.chatRecord.ChatRecord; import com.xinelu.manage.domain.chatRecord.ChatRecord;
import com.xinelu.manage.dto.chatrecord.ChatRecordDTO;
import com.xinelu.manage.dto.chatrecord.MessageSearchDto;
import com.xinelu.manage.service.chatrecord.IChatRecordService;
import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import com.xinelu.manage.vo.chatrecord.MessageCenterVo;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
/** /**
@ -38,6 +48,12 @@ public class ChatRecordController extends BaseController {
@Autowired @Autowired
private IChatRecordService chatRecordService; private IChatRecordService chatRecordService;
@Resource
private IPatientInfoService patientInfoService;
@Resource
private IHospitalPersonInfoService hospitalPersonInfoService;
/** /**
* 查询聊天记录 * 查询聊天记录
*/ */
@ -96,16 +112,20 @@ public class ChatRecordController extends BaseController {
@ApiOperation(value = "获取指定类型的消息记录", notes = "1通知公告 2健康推送 4消息通知") @ApiOperation(value = "获取指定类型的消息记录", notes = "1通知公告 2健康推送 4消息通知")
@GetMapping("/getMegList") @GetMapping("/getMegList")
public TableDataInfo getMegList(MessageSearchDto messageDto, @RequestHeader("region") String region) { public TableDataInfo getMegList(MessageSearchDto messageDto) {
if (messageDto.getPatientId() == null) { if (messageDto.getPatientId() == null) {
throw new ServiceException("居民业务主键不能为空"); throw new ServiceException("居民业务主键不能为空");
} }
if (StringUtils.isBlank(messageDto.getMessageCategory())) { if (StringUtils.isBlank(messageDto.getMessageCategory())) {
throw new ServiceException("消息类型不能为空"); throw new ServiceException("消息类型不能为空");
} }
messageDto.setCityCode(region); // 获取注册信息
PatientInfoVO patientInfo = patientInfoService.selectPatientInfoById(messageDto.getPatientId());
if (patientInfo == null) {
throw new ServiceException("未查询到注册信息");
}
startPage(); startPage();
return getDataTable(chatRecordService.getMegList(messageDto)); return getDataTable(chatRecordService.getMegList(messageDto, patientInfo));
} }
@ApiOperation("删除消息") @ApiOperation("删除消息")
@ -116,4 +136,6 @@ public class ChatRecordController extends BaseController {
} }
return chatRecordService.deleteMegs(ids) > 0 ? R.ok("删除成功") : R.fail("删除失败"); return chatRecordService.deleteMegs(ids) > 0 ? R.ok("删除成功") : R.fail("删除失败");
} }
} }

View File

@ -44,6 +44,11 @@ public class ChatRecord extends BaseEntity implements Serializable {
*/ */
private String messageCategory; private String messageCategory;
/**
* 消息来源用于跳转 1筛查结果2视频问诊
*/
private String sourceType;
/** /**
* 通知适用人群0全部人群 * 通知适用人群0全部人群
*/ */

View File

@ -0,0 +1,38 @@
package com.xinelu.manage.domain.chatrecordread;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;
/**
* 通知公告健康推送已读表
* @TableName chat_record_read
*/
@Data
public class ChatRecordRead extends BaseEntity {
/**
* 主键
*/
private Integer id;
/**
* 居民主键
*/
private Long patientId;
@ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知")
private String messageCategory;
/**
* 消息通知主键
*/
private Long chatRecordId;
/**
* 阅读时间时间格式yyyy-MM-dd HH:mm:ss
*/
private Date readTime;
private static final long serialVersionUID = 1L;
}

View File

@ -28,6 +28,11 @@ public class ChatRecordDTO extends BaseEntity implements Serializable {
@ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知") @ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知")
private String messageCategory; private String messageCategory;
/**
* 消息来源用于跳转 1筛查结果2视频问诊
*/
private String sourceType;
/** /**
* 聊天记录业务主键(问诊表id) * 聊天记录业务主键(问诊表id)
*/ */

View File

@ -61,7 +61,7 @@ public class MessageSearchDto {
@ApiModelProperty(value = "每页大小") @ApiModelProperty(value = "每页大小")
private Integer pageSize = 15; private Integer pageSize = 15;
@ApiModelProperty(value = "通知适用人群编号集合", hidden = true) @ApiModelProperty(value = "通知适用人群编号集合")
private List<String> crowdNoList; private List<String> crowdNoList;
@ApiModelProperty("城市编码(1德州 2东营)") @ApiModelProperty("城市编码(1德州 2东营)")

View File

@ -27,7 +27,7 @@ public interface ChatRecordMapper {
**/ **/
List<MessageVo> selectMegList(MessageSearchDto messageDto); List<MessageVo> selectMegList(MessageSearchDto messageDto);
MessageCenterVo selectOneChatRecord(@Param("bindingNo")Long bindingNo, @Param("doctorNo")Long doctorNo); MessageCenterVo selectOneChatRecord(@Param("consultationId")Long consultationId);
/** /**
* 查询图文咨询-聊天记录 * 查询图文咨询-聊天记录
* *
@ -116,4 +116,6 @@ public interface ChatRecordMapper {
**/ **/
void updateChatRecordOfNo(ChatRecord entity); void updateChatRecordOfNo(ChatRecord entity);
List<ChatRecord> getList(ChatRecord chatRecord);
} }

View File

@ -0,0 +1,29 @@
package com.xinelu.manage.mapper.chatrecordread;
import com.xinelu.manage.domain.chatrecordread.ChatRecordRead;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* @author haown
* @description 针对表chat_record_read(通知公告健康推送已读表)的数据库操作Mapper
* @createDate 2023-11-10 09:49:08
* @Entity com.xinelu.manage.domain.chatrecordread.ChatRecordRead
*/
public interface ChatRecordReadMapper {
int deleteByPrimaryKey(Long id);
int insertList(@Param("recordList") List<ChatRecordRead> recordList);
int insertSelective(ChatRecordRead record);
ChatRecordRead selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(ChatRecordRead record);
int updateByPrimaryKey(ChatRecordRead record);
List<ChatRecordRead> getList(ChatRecordRead chatRecordRead);
}

View File

@ -8,6 +8,7 @@ import com.xinelu.manage.dto.chatrecord.ChatRecordDTO;
import com.xinelu.manage.dto.chatrecord.MessageSearchDto; import com.xinelu.manage.dto.chatrecord.MessageSearchDto;
import com.xinelu.manage.vo.chatrecord.MessageCenterVo; import com.xinelu.manage.vo.chatrecord.MessageCenterVo;
import com.xinelu.manage.vo.chatrecord.MessageVo; import com.xinelu.manage.vo.chatrecord.MessageVo;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -88,7 +89,7 @@ public interface IChatRecordService {
* @Param [messageDto] * @Param [messageDto]
* @return java.util.List<com.xinelu.applet.vo.chatrecord.MessageVo> * @return java.util.List<com.xinelu.applet.vo.chatrecord.MessageVo>
**/ **/
List<MessageVo> getMegList(MessageSearchDto messageDto); List<MessageVo> getMegList(MessageSearchDto messageDto, PatientInfoVO patientInfo);
Integer deleteMegs(List<Long> ids); Integer deleteMegs(List<Long> ids);
@ -129,4 +130,10 @@ public interface IChatRecordService {
**/ **/
void updateChatRecordOfNo(ChatRecord entity); void updateChatRecordOfNo(ChatRecord entity);
/**
* 根据条件查询消息通知
* @param chatRecord
* @return
*/
List<ChatRecord> getList(ChatRecord chatRecord);
} }

View File

@ -18,13 +18,14 @@ import com.xinelu.common.utils.http.HttpService;
import com.xinelu.common.utils.spring.SpringUtils; import com.xinelu.common.utils.spring.SpringUtils;
import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.common.utils.uuid.IdUtils;
import com.xinelu.manage.domain.chatRecord.ChatRecord; import com.xinelu.manage.domain.chatRecord.ChatRecord;
import com.xinelu.manage.domain.chatrecordread.ChatRecordRead;
import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo;
import com.xinelu.manage.dto.chatrecord.ChatRecordDTO; import com.xinelu.manage.dto.chatrecord.ChatRecordDTO;
import com.xinelu.manage.dto.chatrecord.MessageSearchDto; import com.xinelu.manage.dto.chatrecord.MessageSearchDto;
import com.xinelu.manage.mapper.chatrecord.ChatRecordMapper; import com.xinelu.manage.mapper.chatrecord.ChatRecordMapper;
import com.xinelu.manage.service.chatrecord.IChatRecordService; import com.xinelu.manage.service.chatrecord.IChatRecordService;
import com.xinelu.manage.service.chatrecordread.IChatRecordReadService;
import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService; import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import com.xinelu.manage.vo.chatrecord.MessageCenterVo; import com.xinelu.manage.vo.chatrecord.MessageCenterVo;
import com.xinelu.manage.vo.chatrecord.MessageVo; import com.xinelu.manage.vo.chatrecord.MessageVo;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO; import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
@ -32,7 +33,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -56,8 +56,8 @@ public class ChatRecordServiceImpl implements IChatRecordService {
private XinELuConfig xinYiLuConfig; private XinELuConfig xinYiLuConfig;
@Resource @Resource
private IHospitalPersonInfoService hospitalPersonInfoService; private IHospitalPersonInfoService hospitalPersonInfoService;
@Resource @Resource
private IPatientInfoService patientInfoService; private IChatRecordReadService chatRecordReadService;
@Resource @Resource
private HttpService httpService; private HttpService httpService;
@ -122,10 +122,45 @@ public class ChatRecordServiceImpl implements IChatRecordService {
*/ */
@Override @Override
public int updateChatRecord(ChatRecord chatRecord) { public int updateChatRecord(ChatRecord chatRecord) {
//更新已读时间 // 通知公告或健康推送单独记录消息已读未读
chatRecord.setReadTime(DateUtils.getNowDate()); if (StringUtils.equals("1", chatRecord.getMessageCategory()) || StringUtils.equals("2", chatRecord.getMessageCategory())) {
chatRecord.setReadStatus("1"); // 查询当前时间之前的通知公告/健康推送
return chatRecordMapper.updateReadStatus(chatRecord); chatRecord.setReadStatus(null);
List<ChatRecord> recordList = getList(chatRecord);
ChatRecordRead chatRecordRead = new ChatRecordRead();
chatRecordRead.setPatientId(chatRecord.getRecipientId());
chatRecordRead.setMessageCategory(chatRecord.getMessageCategory());
List<ChatRecordRead> readList = chatRecordReadService.getList(chatRecordRead);
List<ChatRecord> newList = recordList;
if (!CollectionUtils.isEmpty(readList)) {
List<Long> readIdList = readList.stream().map(ChatRecordRead::getChatRecordId).collect(Collectors.toList());
newList = recordList.stream().filter(m -> !readIdList.contains(m.getId())).collect(Collectors.toList());
}
List<ChatRecordRead> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(newList)) {
newList.forEach(
record -> {
ChatRecordRead addRecord = new ChatRecordRead();
addRecord.setPatientId(chatRecord.getRecipientId());
addRecord.setMessageCategory(chatRecord.getMessageCategory());
addRecord.setReadTime(DateUtils.getNowDate());
addRecord.setChatRecordId(record.getId());
list.add(addRecord);
}
);
}
if (!CollectionUtils.isEmpty(list)) {
chatRecordReadService.insertList(list);
}
} else {
// 更新已读时间
chatRecord.setReadTime(DateUtils.getNowDate());
chatRecord.setReadStatus("1");
chatRecord.setConsultationId(chatRecord.getConsultationId());
}
return chatRecordMapper.updateChatRecord(chatRecord);
} }
/** /**
@ -183,49 +218,68 @@ public class ChatRecordServiceImpl implements IChatRecordService {
groupByCategory.keySet().forEach(key -> { groupByCategory.keySet().forEach(key -> {
MessageCenterVo megCenter = new MessageCenterVo(); MessageCenterVo megCenter = new MessageCenterVo();
if (!StringUtils.equals("3", key)) { switch(key) {
if (groupByCategory.get(key) != null && groupByCategory.get(key).size() > 0) { case "1":
org.springframework.beans.BeanUtils.copyProperties(groupByCategory.get(key).get(0), megCenter); case "2":
Long unreadCount = groupByCategory.get(key).stream().collect(Collectors.groupingBy(MessageVo::getReadStatus, Collectors.counting())).get("0"); if (groupByCategory.get(key) != null && groupByCategory.get(key).size() > 0) {
megCenter.setUnreadCount(unreadCount == null ? 0 : unreadCount.intValue()); BeanUtils.copyProperties(groupByCategory.get(key).get(0), megCenter);
messageCenterVos.add(megCenter); // 总条数
} int sum = groupByCategory.get(key).size();
} else { int readCount = 0;
// 在线咨询 // 查询已读条数
List<MessageVo> chatList = groupByCategory.get(key); ChatRecordRead chatRecordRead = new ChatRecordRead();
if (chatList != null && chatList.size() > 0) { chatRecordRead.setMessageCategory(key);
Map<Long, List<MessageVo>> groupByReceive = chatList.stream().collect(Collectors.groupingBy(MessageVo::getRecipientId)); chatRecordRead.setPatientId(messageDto.getRecipientId());
// 统计未读条数 List<ChatRecordRead> readList = chatRecordReadService.getList(chatRecordRead);
Map<Long, Integer> unReadMap = new HashMap<>(); if (!CollectionUtils.isEmpty(readList)) {
if (groupByReceive.get(messageDto.getRecipientId()) != null && groupByReceive.get(messageDto.getRecipientId()).size() > 0) { readCount = readList.size();
Map<Long, List<MessageVo>> groupBySender = groupByReceive.get(messageDto.getRecipientId()).stream().collect(Collectors.groupingBy(MessageVo::getSenderId)); }
groupBySender.keySet().forEach(sender -> { int unreadCount = sum - readCount;
unReadMap.put(sender, (int) groupBySender.get(sender).stream().filter(meg -> meg.getReadStatus().equals("0")).count()); megCenter.setUnreadCount(Math.max(unreadCount, 0));
messageCenterVos.add(megCenter);
}
break;
case "3":
// 在线咨询
List<MessageVo> chatList = groupByCategory.get(key);
if (chatList != null && chatList.size() > 0) {
// 先根据consultationId分组
Map<Long, List<MessageVo>> groupByConsultation = chatList.stream().collect(Collectors.groupingBy(MessageVo::getConsultationId));
groupByConsultation.keySet().forEach(consultationId -> {
// 统计未读条数
List<MessageVo> unreadList = groupByConsultation.get(consultationId).stream().filter(m ->
m.getRecipientId() == messageDto.getRecipientId() && StringUtils.equals("0", m.getReadStatus())
).collect(Collectors.toList());
long receive = groupByConsultation.get(consultationId).get(0).getRecipientId();
MessageCenterVo chat = chatRecordMapper.selectOneChatRecord(consultationId);
if (receive != messageDto.getRecipientId()) {
// 查询咨询的最新一条聊天记录
if (chat.getSenderId().equals(messageDto.getRecipientId())) {
// 如果发送人是当前登录用户则把发送人与接收人颠倒
Long recipientNo = chat.getSenderId();
String recipientName = chat.getSenderName();
chat.setSenderId(chat.getRecipientId());
chat.setSenderName(chat.getRecipientName());
chat.setRecipientId(recipientNo);
chat.setRecipientName(recipientName);
chat.setConsultationId(chat.getConsultationId());
}
}
chat.setUnreadCount(CollectionUtils.isEmpty(unreadList) ? 0 : unreadList.size());
messageCenterVos.add(chat);
}); });
} }
if (StringUtils.equals("1", messageDto.getUserType())) { break;
// 医生端消息,根据发送者分组 case "4":
groupByReceive = chatList.stream().collect(Collectors.groupingBy(MessageVo::getSenderId)); if (groupByCategory.get(key) != null && groupByCategory.get(key).size() > 0) {
BeanUtils.copyProperties(groupByCategory.get(key).get(0), megCenter);
Long unreadCount = groupByCategory.get(key).stream().collect(Collectors.groupingBy(MessageVo::getReadStatus, Collectors.counting())).get("0");
megCenter.setUnreadCount(unreadCount == null ? 0 : unreadCount.intValue());
messageCenterVos.add(megCenter);
} }
break;
groupByReceive.keySet().forEach(receive -> {
if (!receive.equals(messageDto.getRecipientId())) {
// 查询doctor与当前登录用户最新一条聊天记录
MessageCenterVo chat = chatRecordMapper.selectOneChatRecord(messageDto.getRecipientId(), receive);
if (chat.getSenderId().equals(messageDto.getRecipientId())) {
// 如果发送人是当前登录用户则把发送人与接收人颠倒
Long recipientNo = chat.getSenderId();
String recipientName = chat.getSenderName();
chat.setSenderId(chat.getRecipientId());
chat.setSenderName(chat.getRecipientName());
chat.setRecipientId(recipientNo);
chat.setRecipientName(recipientName);
}
chat.setUnreadCount(unReadMap.get(receive) == null ? 0 : unReadMap.get(receive));
messageCenterVos.add(chat);
}
});
}
} }
}); });
} }
@ -241,12 +295,8 @@ public class ChatRecordServiceImpl implements IChatRecordService {
* @return java.util.List<com.xinelu.applet.vo.chatrecord.MessageVo> * @return java.util.List<com.xinelu.applet.vo.chatrecord.MessageVo>
**/ **/
@Override @Override
public List<MessageVo> getMegList(MessageSearchDto messageDto) { public List<MessageVo> getMegList(MessageSearchDto messageDto, PatientInfoVO patientInfo) {
// 获取注册信息
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()); 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)); messageDto.setBindingTime(DateUtils.parseDate(bindTimeStr));
@ -339,4 +389,7 @@ public class ChatRecordServiceImpl implements IChatRecordService {
chatRecordMapper.updateChatRecordOfNo(entity); chatRecordMapper.updateChatRecordOfNo(entity);
} }
@Override public List<ChatRecord> getList(ChatRecord chatRecord) {
return chatRecordMapper.getList(chatRecord);
}
} }

View File

@ -0,0 +1,18 @@
package com.xinelu.manage.service.chatrecordread;
import com.xinelu.manage.domain.chatrecordread.ChatRecordRead;
import java.util.List;
/**
* @author haown
* @description 针对表chat_record_read(通知公告健康推送已读表)的数据库操作Service
* @createDate 2023-11-10 09:48:48
*/
public interface IChatRecordReadService {
int insertList(List<ChatRecordRead> recordList);
// 查询已读条数
List<ChatRecordRead> getList(ChatRecordRead chatRecordRead);
}

View File

@ -0,0 +1,28 @@
package com.xinelu.manage.service.chatrecordread.impl;
import com.xinelu.manage.domain.chatrecordread.ChatRecordRead;
import com.xinelu.manage.mapper.chatrecordread.ChatRecordReadMapper;
import com.xinelu.manage.service.chatrecordread.IChatRecordReadService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
/**
* @author haown
* @description 针对表chat_record_read(通知公告健康推送已读表)的数据库操作Service实现
* @createDate 2023-11-10 09:48:48
*/
@Service
public class ChatRecordReadServiceImpl implements IChatRecordReadService {
@Resource
private ChatRecordReadMapper chatRecordReadMapper;
@Override public int insertList(List<ChatRecordRead> recordList) {
return chatRecordReadMapper.insertList(recordList);
}
@Override public List<ChatRecordRead> getList(ChatRecordRead chatRecordRead) {
return chatRecordReadMapper.getList(chatRecordRead);
}
}

View File

@ -204,7 +204,7 @@ public class ConsultationInfoServiceImpl implements IConsultationInfoService {
.fluentPut("cardNo", patient.getCardNo()) .fluentPut("cardNo", patient.getCardNo())
.fluentPut("senderName", consultationInfo.getDoctorName()) .fluentPut("senderName", consultationInfo.getDoctorName())
.fluentPut("contentId", goodOrder.getId()) .fluentPut("contentId", goodOrder.getId())
.fluentPut("sourceType", "1"); .fluentPut("sourceType", "2");
messagePushService.fdApprovePush(result); messagePushService.fdApprovePush(result);
return AjaxResult.success(roomId); return AjaxResult.success(roomId);
} }

View File

@ -300,6 +300,9 @@ public class MessagePushServiceImpl implements MessagePushService {
if (body.containsKey("contentId")) { if (body.containsKey("contentId")) {
chatRecord.setContentId(body.getString("contentId")); chatRecord.setContentId(body.getString("contentId"));
} }
if (body.containsKey("sourceType")) {
chatRecord.setSourceType(body.getString("sourceType"));
}
chatRecord.setContent(body.getString("sendContent")); chatRecord.setContent(body.getString("sendContent"));
chatRecord.setRecipientName(body.getString("receiveName")); chatRecord.setRecipientName(body.getString("receiveName"));
chatRecord.setSenderName(body.getString("senderName")); chatRecord.setSenderName(body.getString("senderName"));

View File

@ -185,6 +185,8 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService {
result.put("messageType", "6"); result.put("messageType", "6");
result.put("messageCategory", "4"); result.put("messageCategory", "4");
result.put("cardNo", registerVo.getCardNo()); result.put("cardNo", registerVo.getCardNo());
result.put("contentId", body.getScreeningId());
result.put("sourceType", "1");
} }
return result; return result;
} }

View File

@ -85,4 +85,14 @@ public class AppointmentOrderVO implements Serializable {
* 订单类型院内陪护COMPANION_IN_HOSPITAL其它OTHER * 订单类型院内陪护COMPANION_IN_HOSPITAL其它OTHER
*/ */
private String orderType; private String orderType;
/**
* 住址经度
*/
private String homeLongitude;
/**
* 住址纬度
*/
private String homeLatitude;
} }

View File

@ -18,6 +18,16 @@ public class MessageCenterVo {
@ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知") @ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知")
private String messageCategory; private String messageCategory;
/**
* 消息来源用于跳转 1筛查结果2视频问诊
*/
private String sourceType;
/**
* 聊天记录业务主键(问诊表id)
*/
private Long consultationId;
@ApiModelProperty("通知适用人群0全部人群") @ApiModelProperty("通知适用人群0全部人群")
private String crowds; private String crowds;

View File

@ -21,6 +21,16 @@ public class MessageVo {
@ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知") @ApiModelProperty("消息类别 1通知公告2健康推送3在线咨询 4消息通知")
private String messageCategory; private String messageCategory;
/**
* 消息来源用于跳转 1筛查结果2视频问诊
*/
private String sourceType;
/**
* 聊天记录业务主键(问诊表id)
*/
private Long consultationId;
@ApiModelProperty("通知适用人群0全部人群") @ApiModelProperty("通知适用人群0全部人群")
private String crowds; private String crowds;

View File

@ -154,6 +154,8 @@
ao.order_check_status, ao.order_check_status,
ao.order_type, ao.order_type,
pi.patient_name, pi.patient_name,
pi.home_longitude,
pi.home_latitude,
nsp.nurse_person_name, nsp.nurse_person_name,
aod.id detailsId, aod.id detailsId,
aod.order_no, aod.order_no,

View File

@ -8,6 +8,7 @@
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="messageNo" column="message_no"/> <result property="messageNo" column="message_no"/>
<result property="messageCategory" column="message_category"/> <result property="messageCategory" column="message_category"/>
<result property="sourceType" column="source_type"/>
<result property="consultationId" column="consultation_id"/> <result property="consultationId" column="consultation_id"/>
<result property="crowds" column="crowds"/> <result property="crowds" column="crowds"/>
<result property="crowdsName" column="crowds_name"/> <result property="crowdsName" column="crowds_name"/>
@ -33,6 +34,7 @@
select id, select id,
message_no, message_no,
message_category, message_category,
source_type,
consultation_id, consultation_id,
crowds, crowds,
crowds_name, crowds_name,
@ -57,10 +59,10 @@
<sql id="Message_Vo_List"> <sql id="Message_Vo_List">
message_no message_no
,message_category,crowds,crowds_name,sender_id,crowds,crowds_name, ,message_category,source_type,consultation_id,crowds,crowds_name,sender_id,
sender_name,send_time,recipient_id, sender_name,send_time,recipient_id,
recipient_name,message_type,title,content,content_id, recipient_name,message_type,title,content,content_id,
read_status read_status,title
</sql> </sql>
<select id="selectMegVoList" parameterType="com.xinelu.manage.dto.chatrecord.MessageSearchDto" <select id="selectMegVoList" parameterType="com.xinelu.manage.dto.chatrecord.MessageSearchDto"
@ -68,7 +70,16 @@
select select
<include refid="Message_Vo_List"/> <include refid="Message_Vo_List"/>
from chat_record from chat_record
where del_flag = 0 and (recipient_id = #{recipientId} or sender_id = #{recipientId}) where del_flag = 0
and (recipient_id = #{recipientId} or sender_id = #{recipientId}
<if test="crowdNoList != null and crowdNoList.size() > 0">
or
<foreach collection="crowdNoList" item="no" open="(" separator="or" close=")">
FIND_IN_SET(#{no}, crowds)
</foreach>
or crowds = '0'
</if>
)
<if test="messageCategory != null"> <if test="messageCategory != null">
and message_category = #{messageCategory} and message_category = #{messageCategory}
</if> </if>
@ -114,9 +125,10 @@
order by send_time desc order by send_time desc
</select> </select>
<select id="selectOneChatRecord" parameterType="java.lang.String" <select id="selectOneChatRecord" parameterType="java.lang.Long"
resultType="com.xinelu.manage.vo.chatrecord.MessageCenterVo"> resultType="com.xinelu.manage.vo.chatrecord.MessageCenterVo">
select message_category, select message_category,
consultation_id,
crowds, crowds,
crowds_name, crowds_name,
sender_id, sender_id,
@ -129,8 +141,7 @@
from chat_record from chat_record
where del_flag = 0 where del_flag = 0
and message_category = '3' and message_category = '3'
and ((sender_id = #{bindingNo} and recipient_id = #{doctorNo}) and consultation_id = #{consultationId}
or (sender_id = #{doctorNo} and recipient_id = #{bindingNo}))
ORDER BY send_time desc limit 1 ORDER BY send_time desc limit 1
</select> </select>
@ -218,6 +229,8 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="messageCategory != null">message_category, <if test="messageCategory != null">message_category,
</if> </if>
<if test="sourceType != null">source_type,
</if>
<if test="messageNo != null">message_no, <if test="messageNo != null">message_no,
</if> </if>
<if test="consultationId != null">consultation_id, <if test="consultationId != null">consultation_id,
@ -262,6 +275,8 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="messageCategory != null">#{messageCategory}, <if test="messageCategory != null">#{messageCategory},
</if> </if>
<if test="sourceType != null">#{sourceType},
</if>
<if test="messageNo != null">#{messageNo}, <if test="messageNo != null">#{messageNo},
</if> </if>
<if test="consultationId != null">#{consultationId}, <if test="consultationId != null">#{consultationId},
@ -306,70 +321,40 @@
</insert> </insert>
<update id="updateChatRecord" parameterType="ChatRecord"> <update id="updateChatRecord" parameterType="ChatRecord">
update chat_record update chat_record set
<trim prefix="SET" suffixOverrides=","> read_status = #{readStatus},
<if test="messageCategory != null">message_category = read_time = #{readTime}
#{messageCategory}, where del_flag = '0'
<if test="messageCategory != null">
and message_category = #{messageCategory}
</if> </if>
<if test="consultationId != null">consultation_id = <if test="consultationId != null">
#{consultationId}, and consultation_id = #{consultationId}
</if> </if>
<if test="crowds != null">crowds = <if test="crowds != null">
#{crowds}, and crowds = #{crowds}
</if> </if>
<if test="crowdsName != null">crowds_name = <if test="crowdsName != null">
#{crowdsName}, and crowds_name = #{crowdsName}
</if> </if>
<if test="senderId != null">sender_id = <if test="senderId != null">
#{senderId}, and sender_id = #{senderId}
</if> </if>
<if test="senderName != null and senderName != ''">sender_name = <if test="senderName != null and senderName != ''">
#{senderName}, and sender_name = #{senderName}
</if> </if>
<if test="sendTime != null">send_time = <if test="sendTime != null">
#{sendTime}, and send_time = #{sendTime}
</if> </if>
<if test="recipientId != null">recipient_id = <if test="recipientId != null">
#{recipientId}, and recipient_id = #{recipientId}
</if> </if>
<if test="recipientName != null and recipientName != ''">recipient_name = <if test="messageType != null">
#{recipientName}, and message_type = #{messageType}
</if> </if>
<if test="messageType != null">message_type = <if test="id != null">
#{messageType}, and id = #{id}
</if> </if>
<if test="title != null">title =
#{title},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="contentId != null">content_id =
#{contentId},
</if>
<if test="readStatus != null">read_status =
#{readStatus},
</if>
<if test="readTime != null">read_time =
#{readTime},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update> </update>
<update id="updateReadStatus" parameterType="ChatRecord"> <update id="updateReadStatus" parameterType="ChatRecord">
@ -390,6 +375,7 @@
update chat_record update chat_record
<set> <set>
<if test="messageCategory != null">message_category = #{messageCategory},</if> <if test="messageCategory != null">message_category = #{messageCategory},</if>
<if test="sourceType != null">source_type = #{sourceType},</if>
<if test="consultationId != null">consultation_id = #{consultationId},</if> <if test="consultationId != null">consultation_id = #{consultationId},</if>
<if test="crowds != null">crowds = #{crowds},</if> <if test="crowds != null">crowds = #{crowds},</if>
<if test="crowdsName != null">crowds_name = #{crowdsName},</if> <if test="crowdsName != null">crowds_name = #{crowdsName},</if>
@ -441,4 +427,28 @@
</where> </where>
</update> </update>
<select id="getList"
resultType="com.xinelu.manage.domain.chatRecord.ChatRecord">
select id,
message_category,
consultation_id,
crowds,
crowds_name,
sender_id,
sender_name,
send_time,
message_type,
content,
recipient_id,
recipient_name
from chat_record
where del_flag = 0
<if test="sendTime != null">
and send_time &lt;= #{sendTime}
</if>
<if test="messageCategory != null">
and message_category = #{messageCategory}
</if>
ORDER BY send_time desc
</select>
</mapper> </mapper>

View File

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.manage.mapper.chatrecordread.ChatRecordReadMapper">
<resultMap id="BaseResultMap" type="com.xinelu.manage.domain.chatrecordread.ChatRecordRead">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="patientId" column="patient_id" jdbcType="BIGINT"/>
<result property="messageCategory" column="message_category" jdbcType="VARCHAR"/>
<result property="chatRecordId" column="chat_record_id" jdbcType="BIGINT"/>
<result property="readTime" column="read_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,patient_id,message_category,chat_record_id,
read_time,create_by,create_time,
update_by,update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from chat_record_read
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from chat_record_read
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insertList" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.chatrecordread.ChatRecordRead" useGeneratedKeys="true">
insert into chat_record_read
( id,patient_id,message_category,chat_record_id
,read_time,create_by,create_time
,update_by,update_time)
values
<foreach collection="recordList" item="item" separator=",">
(#{item.id,jdbcType=INTEGER},#{item.patientId,jdbcType=BIGINT},#{item.messageCategory,jdbcType=VARCHAR},
#{item.chatRecordId,jdbcType=BIGINT}
,#{item.readTime,jdbcType=TIMESTAMP},#{item.createBy,jdbcType=VARCHAR},#{item.createTime,jdbcType=TIMESTAMP}
,#{item.updateBy,jdbcType=VARCHAR},#{item.updateTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.chatrecordread.ChatRecordRead" useGeneratedKeys="true">
insert into chat_record_read
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="patientId != null">patient_id,</if>
<if test="messageCategory != null">message_category,</if>
<if test="chatRecordId != null">chat_record_id,</if>
<if test="readTime != null">read_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="patientId != null">#{patientId,jdbcType=BIGINT},</if>
<if test="messageCategory != null">#{messageCategory,jdbcType=VARCHAR},</if>
<if test="chatRecordId != null">#{chatRecordId,jdbcType=BIGINT},</if>
<if test="readTime != null">#{readTime,jdbcType=TIMESTAMP},</if>
<if test="createBy != null">#{createBy,jdbcType=VARCHAR},</if>
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
<if test="updateBy != null">#{updateBy,jdbcType=VARCHAR},</if>
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xinelu.manage.domain.chatrecordread.ChatRecordRead">
update chat_record_read
<set>
<if test="patientId != null">
patient_id = #{patientId,jdbcType=BIGINT},
</if>
<if test="messageCategory != null">
message_category = #{messageCategory,jdbcType=VARCHAR},
</if>
<if test="chatRecordId != null">
chat_record_id = #{chatRecordId,jdbcType=BIGINT},
</if>
<if test="readTime != null">
read_time = #{readTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.xinelu.manage.domain.chatrecordread.ChatRecordRead">
update chat_record_read
set
patient_id = #{patientId,jdbcType=BIGINT},
message_category = #{messageCategory,jdbcType=VARCHAR},
chat_record_id = #{chatRecordId,jdbcType=BIGINT},
read_time = #{readTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from chat_record_read
<where>
<if test="patientId != null">
and patient_id = #{patientId,jdbcType=BIGINT}
</if>
<if test="messageCategory != null">
and message_category = #{messageCategory,jdbcType=VARCHAR}
</if>
<if test="chatRecordId != null">
and chat_record_id = #{chatRecordId,jdbcType=BIGINT}
</if>
<if test="readTime != null">
and read_time = #{readTime,jdbcType=TIMESTAMP}
</if>
</where>
</select>
</mapper>