From 54b750f853b53c7ff0471e1ccbc915092b285632 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Fri, 10 Nov 2023 17:31:50 +0800 Subject: [PATCH] =?UTF-8?q?update=3D=3D=3D>:=E6=B6=88=E6=81=AF=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EvaluateSurveyController.java | 2 + .../AppletScreeningProjectController.java | 1 + .../chatrecord/ChatRecordController.java | 27 ++- .../manage/domain/chatRecord/ChatRecord.java | 5 + .../domain/chatrecordread/ChatRecordRead.java | 38 +++++ .../manage/dto/chatrecord/ChatRecordDTO.java | 5 + .../dto/chatrecord/MessageSearchDto.java | 4 +- .../mapper/chatrecord/ChatRecordMapper.java | 4 +- .../chatrecordread/ChatRecordReadMapper.java | 29 ++++ .../chatrecord/IChatRecordService.java | 9 +- .../impl/ChatRecordServiceImpl.java | 161 ++++++++++++------ .../IChatRecordReadService.java | 18 ++ .../impl/ChatRecordReadServiceImpl.java | 28 +++ .../impl/ConsultationInfoServiceImpl.java | 2 +- .../Impl/MessagePushServiceImpl.java | 3 + .../impl/ScreeningRecordServiceImpl.java | 2 + .../manage/vo/chatrecord/MessageCenterVo.java | 10 ++ .../manage/vo/chatrecord/MessageVo.java | 10 ++ .../manage/chatrecord/ChatRecordMapper.xml | 132 +++++++------- .../chatrecordread/ChatRecordReadMapper.xml | 137 +++++++++++++++ 20 files changed, 503 insertions(+), 124 deletions(-) create mode 100644 xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatrecordread/ChatRecordRead.java create mode 100644 xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecordread/ChatRecordReadMapper.java create mode 100644 xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/IChatRecordReadService.java create mode 100644 xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/impl/ChatRecordReadServiceImpl.java create mode 100644 xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecordread/ChatRecordReadMapper.xml diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateSurveyController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateSurveyController.java index 5c8fa2e..02165eb 100644 --- a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateSurveyController.java +++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateSurveyController.java @@ -1,5 +1,6 @@ package com.xinelu.web.controller.familydoctor; +import com.xinelu.common.annotation.MobileRequestAuthorization; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.page.TableDataInfo; @@ -31,6 +32,7 @@ public class EvaluateSurveyController extends BaseController { @ApiOperation("问卷列表") @GetMapping("survey/list") + @MobileRequestAuthorization public TableDataInfo surveyList(EvaluateSurvey entity) { startPage(); List list = evaluateSurveyService.findList(entity); diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java index 09840b6..1056bcf 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java @@ -48,6 +48,7 @@ public class AppletScreeningProjectController extends BaseController { project.setProjectName(groupByProject.get(projectId).get(0).getProjectName()); project.setHospitalId(groupByProject.get(projectId).get(0).getHospitalId()); project.setHospitalName(groupByProject.get(projectId).get(0).getHospitalName()); + project.setCreateTime(groupByProject.get(projectId).get(0).getApplyStartTime()); projectList.add(project); } } 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 9fc7d4d..b249303 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 @@ -1,9 +1,5 @@ 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.core.controller.BaseController; import com.xinelu.common.core.domain.AjaxResult; @@ -12,10 +8,18 @@ import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.socket.WebSocketUtils; 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.ApiOperation; import java.util.List; import java.util.Objects; +import javax.annotation.Resource; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -44,6 +48,12 @@ public class ChatRecordController extends BaseController { @Autowired private IChatRecordService chatRecordService; + @Resource + private IPatientInfoService patientInfoService; + + @Resource + private IHospitalPersonInfoService hospitalPersonInfoService; + /** * 查询聊天记录 */ @@ -109,8 +119,13 @@ public class ChatRecordController extends BaseController { if (StringUtils.isBlank(messageDto.getMessageCategory())) { throw new ServiceException("消息类型不能为空"); } + // 获取注册信息 + PatientInfoVO patientInfo = patientInfoService.selectPatientInfoById(messageDto.getPatientId()); + if (patientInfo == null) { + throw new ServiceException("未查询到注册信息"); + } startPage(); - return getDataTable(chatRecordService.getMegList(messageDto)); + return getDataTable(chatRecordService.getMegList(messageDto, patientInfo)); } @ApiOperation("删除消息") @@ -121,4 +136,6 @@ public class ChatRecordController extends BaseController { } return chatRecordService.deleteMegs(ids) > 0 ? R.ok("删除成功") : R.fail("删除失败"); } + + } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java index 39cb003..742b347 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java @@ -44,6 +44,11 @@ public class ChatRecord extends BaseEntity implements Serializable { */ private String messageCategory; + /** + * 消息来源,用于跳转 1:筛查结果,2:视频问诊 + */ + private String sourceType; + /** * 通知适用人群(0:全部人群) */ diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatrecordread/ChatRecordRead.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatrecordread/ChatRecordRead.java new file mode 100644 index 0000000..a113e7a --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatrecordread/ChatRecordRead.java @@ -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; + +} \ No newline at end of file diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/ChatRecordDTO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/ChatRecordDTO.java index de2ab65..d295a81 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/ChatRecordDTO.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/ChatRecordDTO.java @@ -28,6 +28,11 @@ public class ChatRecordDTO extends BaseEntity implements Serializable { @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; + /** + * 消息来源,用于跳转 1:筛查结果,2:视频问诊 + */ + private String sourceType; + /** * 聊天记录业务主键(问诊表id) */ diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java index fcdf38c..d2d3f68 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/chatrecord/MessageSearchDto.java @@ -61,6 +61,8 @@ public class MessageSearchDto { @ApiModelProperty(value = "每页大小") private Integer pageSize = 15; - @ApiModelProperty(value = "通知适用人群编号集合", hidden = true) + @ApiModelProperty(value = "通知适用人群编号集合") private List crowdNoList; + + private String cityCode; } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecord/ChatRecordMapper.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecord/ChatRecordMapper.java index 605215e..2d67138 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecord/ChatRecordMapper.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecord/ChatRecordMapper.java @@ -27,7 +27,7 @@ public interface ChatRecordMapper { **/ List 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); + List getList(ChatRecord chatRecord); + } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecordread/ChatRecordReadMapper.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecordread/ChatRecordReadMapper.java new file mode 100644 index 0000000..dd45b7c --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatrecordread/ChatRecordReadMapper.java @@ -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 recordList); + + int insertSelective(ChatRecordRead record); + + ChatRecordRead selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(ChatRecordRead record); + + int updateByPrimaryKey(ChatRecordRead record); + + List getList(ChatRecordRead chatRecordRead); + +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/IChatRecordService.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/IChatRecordService.java index 03d3cb9..a041c46 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/IChatRecordService.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/IChatRecordService.java @@ -8,6 +8,7 @@ import com.xinelu.manage.dto.chatrecord.ChatRecordDTO; import com.xinelu.manage.dto.chatrecord.MessageSearchDto; import com.xinelu.manage.vo.chatrecord.MessageCenterVo; import com.xinelu.manage.vo.chatrecord.MessageVo; +import com.xinelu.manage.vo.patientinfo.PatientInfoVO; import java.io.IOException; import java.util.List; import org.springframework.web.multipart.MultipartFile; @@ -88,7 +89,7 @@ public interface IChatRecordService { * @Param [messageDto] * @return java.util.List **/ - List getMegList(MessageSearchDto messageDto); + List getMegList(MessageSearchDto messageDto, PatientInfoVO patientInfo); Integer deleteMegs(List ids); @@ -129,4 +130,10 @@ public interface IChatRecordService { **/ void updateChatRecordOfNo(ChatRecord entity); + /** + * 根据条件查询消息通知 + * @param chatRecord + * @return + */ + List getList(ChatRecord chatRecord); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java index bc81fe7..061a5f7 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecord/impl/ChatRecordServiceImpl.java @@ -18,13 +18,14 @@ 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 com.xinelu.manage.domain.chatrecordread.ChatRecordRead; import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; import com.xinelu.manage.dto.chatrecord.ChatRecordDTO; import com.xinelu.manage.dto.chatrecord.MessageSearchDto; import com.xinelu.manage.mapper.chatrecord.ChatRecordMapper; 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.patientinfo.IPatientInfoService; import com.xinelu.manage.vo.chatrecord.MessageCenterVo; import com.xinelu.manage.vo.chatrecord.MessageVo; import com.xinelu.manage.vo.patientinfo.PatientInfoVO; @@ -32,7 +33,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -56,8 +56,8 @@ public class ChatRecordServiceImpl implements IChatRecordService { private XinELuConfig xinYiLuConfig; @Resource private IHospitalPersonInfoService hospitalPersonInfoService; - @Resource - private IPatientInfoService patientInfoService; + @Resource + private IChatRecordReadService chatRecordReadService; @Resource private HttpService httpService; @@ -122,9 +122,44 @@ public class ChatRecordServiceImpl implements IChatRecordService { */ @Override public int updateChatRecord(ChatRecord chatRecord) { - //更新已读时间 - chatRecord.setReadTime(DateUtils.getNowDate()); - chatRecord.setReadStatus("1"); + // 通知公告或健康推送单独记录消息已读未读 + if (StringUtils.equals("1", chatRecord.getMessageCategory()) || StringUtils.equals("2", chatRecord.getMessageCategory())) { + // 查询当前时间之前的通知公告/健康推送 + chatRecord.setReadStatus(null); + List recordList = getList(chatRecord); + + ChatRecordRead chatRecordRead = new ChatRecordRead(); + chatRecordRead.setPatientId(chatRecord.getRecipientId()); + chatRecordRead.setMessageCategory(chatRecord.getMessageCategory()); + List readList = chatRecordReadService.getList(chatRecordRead); + + List newList = recordList; + if (!CollectionUtils.isEmpty(readList)) { + List readIdList = readList.stream().map(ChatRecordRead::getChatRecordId).collect(Collectors.toList()); + newList = recordList.stream().filter(m -> !readIdList.contains(m.getId())).collect(Collectors.toList()); + } + List 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 -> { MessageCenterVo megCenter = new MessageCenterVo(); - if (!StringUtils.equals("3", key)) { - if (groupByCategory.get(key) != null && groupByCategory.get(key).size() > 0) { - org.springframework.beans.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); - } - } else { - // 在线咨询 - List chatList = groupByCategory.get(key); - if (chatList != null && chatList.size() > 0) { - Map> groupByReceive = chatList.stream().collect(Collectors.groupingBy(MessageVo::getRecipientId)); - // 统计未读条数 - Map unReadMap = new HashMap<>(); - if (groupByReceive.get(messageDto.getRecipientId()) != null && groupByReceive.get(messageDto.getRecipientId()).size() > 0) { - Map> groupBySender = groupByReceive.get(messageDto.getRecipientId()).stream().collect(Collectors.groupingBy(MessageVo::getSenderId)); - groupBySender.keySet().forEach(sender -> { - unReadMap.put(sender, (int) groupBySender.get(sender).stream().filter(meg -> meg.getReadStatus().equals("0")).count()); + switch(key) { + case "1": + case "2": + if (groupByCategory.get(key) != null && groupByCategory.get(key).size() > 0) { + BeanUtils.copyProperties(groupByCategory.get(key).get(0), megCenter); + // 总条数 + int sum = groupByCategory.get(key).size(); + int readCount = 0; + // 查询已读条数 + ChatRecordRead chatRecordRead = new ChatRecordRead(); + chatRecordRead.setMessageCategory(key); + chatRecordRead.setPatientId(messageDto.getRecipientId()); + List readList = chatRecordReadService.getList(chatRecordRead); + if (!CollectionUtils.isEmpty(readList)) { + readCount = readList.size(); + } + int unreadCount = sum - readCount; + megCenter.setUnreadCount(Math.max(unreadCount, 0)); + messageCenterVos.add(megCenter); + } + break; + case "3": + // 在线咨询 + List chatList = groupByCategory.get(key); + if (chatList != null && chatList.size() > 0) { + // 先根据consultationId分组 + Map> groupByConsultation = chatList.stream().collect(Collectors.groupingBy(MessageVo::getConsultationId)); + + groupByConsultation.keySet().forEach(consultationId -> { + // 统计未读条数 + List 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())) { - // 医生端消息,根据发送者分组 - groupByReceive = chatList.stream().collect(Collectors.groupingBy(MessageVo::getSenderId)); + break; + case "4": + 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); } - - 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); - } - }); - } + break; } }); } @@ -241,12 +295,8 @@ public class ChatRecordServiceImpl implements IChatRecordService { * @return java.util.List **/ @Override - public List getMegList(MessageSearchDto messageDto) { - // 获取注册信息 - PatientInfoVO patientInfo = patientInfoService.selectPatientInfoById(messageDto.getPatientId()); - if (patientInfo == null) { - throw new ServiceException("未查询到注册信息"); - } + public List getMegList(MessageSearchDto messageDto, PatientInfoVO patientInfo) { + 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)); @@ -255,7 +305,7 @@ public class ChatRecordServiceImpl implements IChatRecordService { 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); + String result = (String) httpService.get(SpringUtils.getFdUrl(messageDto.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()); @@ -339,4 +389,7 @@ public class ChatRecordServiceImpl implements IChatRecordService { chatRecordMapper.updateChatRecordOfNo(entity); } + @Override public List getList(ChatRecord chatRecord) { + return chatRecordMapper.getList(chatRecord); + } } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/IChatRecordReadService.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/IChatRecordReadService.java new file mode 100644 index 0000000..6338624 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/IChatRecordReadService.java @@ -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 recordList); + + // 查询已读条数 + List getList(ChatRecordRead chatRecordRead); + +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/impl/ChatRecordReadServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/impl/ChatRecordReadServiceImpl.java new file mode 100644 index 0000000..43147b8 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatrecordread/impl/ChatRecordReadServiceImpl.java @@ -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 recordList) { + return chatRecordReadMapper.insertList(recordList); + } + + @Override public List getList(ChatRecordRead chatRecordRead) { + return chatRecordReadMapper.getList(chatRecordRead); + } +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/impl/ConsultationInfoServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/impl/ConsultationInfoServiceImpl.java index 7842cc8..fb1b482 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/impl/ConsultationInfoServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/impl/ConsultationInfoServiceImpl.java @@ -204,7 +204,7 @@ public class ConsultationInfoServiceImpl implements IConsultationInfoService { .fluentPut("cardNo", patient.getCardNo()) .fluentPut("senderName", consultationInfo.getDoctorName()) .fluentPut("contentId", goodOrder.getId()) - .fluentPut("sourceType", "1"); + .fluentPut("sourceType", "2"); messagePushService.fdApprovePush(result); return AjaxResult.success(roomId); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/messagepush/Impl/MessagePushServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/messagepush/Impl/MessagePushServiceImpl.java index f514061..56614f7 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/messagepush/Impl/MessagePushServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/messagepush/Impl/MessagePushServiceImpl.java @@ -300,6 +300,9 @@ public class MessagePushServiceImpl implements MessagePushService { if (body.containsKey("contentId")) { chatRecord.setContentId(body.getString("contentId")); } + if (body.containsKey("sourceType")) { + chatRecord.setSourceType(body.getString("sourceType")); + } chatRecord.setContent(body.getString("sendContent")); chatRecord.setRecipientName(body.getString("receiveName")); chatRecord.setSenderName(body.getString("senderName")); diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java index bec8bec..5a2ed84 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java @@ -185,6 +185,8 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { result.put("messageType", "6"); result.put("messageCategory", "4"); result.put("cardNo", registerVo.getCardNo()); + result.put("contentId", body.getScreeningId()); + result.put("sourceType", "1"); } return result; } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageCenterVo.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageCenterVo.java index c63fb58..3bc9c98 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageCenterVo.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageCenterVo.java @@ -18,6 +18,16 @@ public class MessageCenterVo { @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; + /** + * 消息来源,用于跳转 1:筛查结果,2:视频问诊 + */ + private String sourceType; + + /** + * 聊天记录业务主键(问诊表id) + */ + private Long consultationId; + @ApiModelProperty("通知适用人群(0:全部人群)") private String crowds; diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageVo.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageVo.java index dd37302..49a734a 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageVo.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/chatrecord/MessageVo.java @@ -21,6 +21,16 @@ public class MessageVo { @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知") private String messageCategory; + /** + * 消息来源,用于跳转 1:筛查结果,2:视频问诊 + */ + private String sourceType; + + /** + * 聊天记录业务主键(问诊表id) + */ + private Long consultationId; + @ApiModelProperty("通知适用人群(0:全部人群)") private String crowds; diff --git a/xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecord/ChatRecordMapper.xml b/xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecord/ChatRecordMapper.xml index 3930ecd..aff433c 100644 --- a/xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecord/ChatRecordMapper.xml +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecord/ChatRecordMapper.xml @@ -8,6 +8,7 @@ + @@ -33,6 +34,7 @@ select id, message_no, message_category, + source_type, consultation_id, crowds, crowds_name, @@ -57,10 +59,10 @@ 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, recipient_name,message_type,title,content,content_id, - read_status + read_status,title - @@ -218,6 +229,8 @@ message_category, + source_type, + message_no, consultation_id, @@ -262,6 +275,8 @@ #{messageCategory}, + #{sourceType}, + #{messageNo}, #{consultationId}, @@ -306,70 +321,40 @@ - update chat_record - - message_category = - #{messageCategory}, + update chat_record set + read_status = #{readStatus}, + read_time = #{readTime} + where del_flag = '0' + + and message_category = #{messageCategory} - consultation_id = - #{consultationId}, + + and consultation_id = #{consultationId} - crowds = - #{crowds}, + + and crowds = #{crowds} - crowds_name = - #{crowdsName}, + + and crowds_name = #{crowdsName} - sender_id = - #{senderId}, + + and sender_id = #{senderId} - sender_name = - #{senderName}, + + and sender_name = #{senderName} - send_time = - #{sendTime}, + + and send_time = #{sendTime} - recipient_id = - #{recipientId}, + + and recipient_id = #{recipientId} - recipient_name = - #{recipientName}, + + and message_type = #{messageType} - message_type = - #{messageType}, - - title = - #{title}, - - content = - #{content}, - - content_id = - #{contentId}, - - read_status = - #{readStatus}, - - read_time = - #{readTime}, - - del_flag = - #{delFlag}, - - create_by = - #{createBy}, - - create_time = - #{createTime}, - - update_by = - #{updateBy}, - - update_time = - #{updateTime}, - - - where id = #{id} + + and id = #{id} + @@ -390,6 +375,7 @@ update chat_record message_category = #{messageCategory}, + source_type = #{sourceType}, consultation_id = #{consultationId}, crowds = #{crowds}, crowds_name = #{crowdsName}, @@ -441,4 +427,28 @@ + diff --git a/xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecordread/ChatRecordReadMapper.xml b/xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecordread/ChatRecordReadMapper.xml new file mode 100644 index 0000000..9859aa3 --- /dev/null +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/chatrecordread/ChatRecordReadMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + id,patient_id,message_category,chat_record_id, + read_time,create_by,create_time, + update_by,update_time + + + + + + delete from chat_record_read + where id = #{id,jdbcType=INTEGER} + + + insert into chat_record_read + ( id,patient_id,message_category,chat_record_id + ,read_time,create_by,create_time + ,update_by,update_time) + values + + (#{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}) + + + + insert into chat_record_read + + id, + patient_id, + message_category, + chat_record_id, + read_time, + create_by, + create_time, + update_by, + update_time, + + + #{id,jdbcType=INTEGER}, + #{patientId,jdbcType=BIGINT}, + #{messageCategory,jdbcType=VARCHAR}, + #{chatRecordId,jdbcType=BIGINT}, + #{readTime,jdbcType=TIMESTAMP}, + #{createBy,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, + #{updateBy,jdbcType=VARCHAR}, + #{updateTime,jdbcType=TIMESTAMP}, + + + + update chat_record_read + + + 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 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} + + + +