update===>:消息中心。
This commit is contained in:
parent
5eb498766e
commit
54b750f853
@ -1,5 +1,6 @@
|
|||||||
package com.xinelu.web.controller.familydoctor;
|
package com.xinelu.web.controller.familydoctor;
|
||||||
|
|
||||||
|
import com.xinelu.common.annotation.MobileRequestAuthorization;
|
||||||
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;
|
||||||
import com.xinelu.common.core.page.TableDataInfo;
|
import com.xinelu.common.core.page.TableDataInfo;
|
||||||
@ -31,6 +32,7 @@ public class EvaluateSurveyController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("问卷列表")
|
@ApiOperation("问卷列表")
|
||||||
@GetMapping("survey/list")
|
@GetMapping("survey/list")
|
||||||
|
@MobileRequestAuthorization
|
||||||
public TableDataInfo surveyList(EvaluateSurvey entity) {
|
public TableDataInfo surveyList(EvaluateSurvey entity) {
|
||||||
startPage();
|
startPage();
|
||||||
List<EvaluateSurvey> list = evaluateSurveyService.findList(entity);
|
List<EvaluateSurvey> list = evaluateSurveyService.findList(entity);
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,10 +8,18 @@ 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;
|
||||||
@ -44,6 +48,12 @@ public class ChatRecordController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IChatRecordService chatRecordService;
|
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())) {
|
if (StringUtils.isBlank(messageDto.getMessageCategory())) {
|
||||||
throw new ServiceException("消息类型不能为空");
|
throw new ServiceException("消息类型不能为空");
|
||||||
}
|
}
|
||||||
|
// 获取注册信息
|
||||||
|
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("删除消息")
|
||||||
@ -121,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("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,11 @@ public class ChatRecord extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String messageCategory;
|
private String messageCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息来源,用于跳转 1:筛查结果,2:视频问诊
|
||||||
|
*/
|
||||||
|
private String sourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知适用人群(0:全部人群)
|
* 通知适用人群(0:全部人群)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@ -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)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -61,6 +61,8 @@ 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;
|
||||||
|
|
||||||
|
private String cityCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
@ -57,7 +57,7 @@ public class ChatRecordServiceImpl implements IChatRecordService {
|
|||||||
@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,9 +122,44 @@ public class ChatRecordServiceImpl implements IChatRecordService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateChatRecord(ChatRecord chatRecord) {
|
public int updateChatRecord(ChatRecord chatRecord) {
|
||||||
|
// 通知公告或健康推送单独记录消息已读未读
|
||||||
|
if (StringUtils.equals("1", chatRecord.getMessageCategory()) || StringUtils.equals("2", chatRecord.getMessageCategory())) {
|
||||||
|
// 查询当前时间之前的通知公告/健康推送
|
||||||
|
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.setReadTime(DateUtils.getNowDate());
|
||||||
chatRecord.setReadStatus("1");
|
chatRecord.setReadStatus("1");
|
||||||
|
chatRecord.setConsultationId(chatRecord.getConsultationId());
|
||||||
|
}
|
||||||
return chatRecordMapper.updateChatRecord(chatRecord);
|
return chatRecordMapper.updateChatRecord(chatRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,35 +218,44 @@ 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) {
|
||||||
|
case "1":
|
||||||
|
case "2":
|
||||||
if (groupByCategory.get(key) != null && groupByCategory.get(key).size() > 0) {
|
if (groupByCategory.get(key) != null && groupByCategory.get(key).size() > 0) {
|
||||||
org.springframework.beans.BeanUtils.copyProperties(groupByCategory.get(key).get(0), megCenter);
|
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());
|
int sum = groupByCategory.get(key).size();
|
||||||
|
int readCount = 0;
|
||||||
|
// 查询已读条数
|
||||||
|
ChatRecordRead chatRecordRead = new ChatRecordRead();
|
||||||
|
chatRecordRead.setMessageCategory(key);
|
||||||
|
chatRecordRead.setPatientId(messageDto.getRecipientId());
|
||||||
|
List<ChatRecordRead> readList = chatRecordReadService.getList(chatRecordRead);
|
||||||
|
if (!CollectionUtils.isEmpty(readList)) {
|
||||||
|
readCount = readList.size();
|
||||||
|
}
|
||||||
|
int unreadCount = sum - readCount;
|
||||||
|
megCenter.setUnreadCount(Math.max(unreadCount, 0));
|
||||||
messageCenterVos.add(megCenter);
|
messageCenterVos.add(megCenter);
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
|
case "3":
|
||||||
// 在线咨询
|
// 在线咨询
|
||||||
List<MessageVo> chatList = groupByCategory.get(key);
|
List<MessageVo> chatList = groupByCategory.get(key);
|
||||||
if (chatList != null && chatList.size() > 0) {
|
if (chatList != null && chatList.size() > 0) {
|
||||||
Map<Long, List<MessageVo>> groupByReceive = chatList.stream().collect(Collectors.groupingBy(MessageVo::getRecipientId));
|
// 先根据consultationId分组
|
||||||
// 统计未读条数
|
Map<Long, List<MessageVo>> groupByConsultation = chatList.stream().collect(Collectors.groupingBy(MessageVo::getConsultationId));
|
||||||
Map<Long, Integer> unReadMap = new HashMap<>();
|
|
||||||
if (groupByReceive.get(messageDto.getRecipientId()) != null && groupByReceive.get(messageDto.getRecipientId()).size() > 0) {
|
|
||||||
Map<Long, List<MessageVo>> 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());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (StringUtils.equals("1", messageDto.getUserType())) {
|
|
||||||
// 医生端消息,根据发送者分组
|
|
||||||
groupByReceive = chatList.stream().collect(Collectors.groupingBy(MessageVo::getSenderId));
|
|
||||||
}
|
|
||||||
|
|
||||||
groupByReceive.keySet().forEach(receive -> {
|
groupByConsultation.keySet().forEach(consultationId -> {
|
||||||
if (!receive.equals(messageDto.getRecipientId())) {
|
// 统计未读条数
|
||||||
// 查询doctor与当前登录用户最新一条聊天记录
|
List<MessageVo> unreadList = groupByConsultation.get(consultationId).stream().filter(m ->
|
||||||
MessageCenterVo chat = chatRecordMapper.selectOneChatRecord(messageDto.getRecipientId(), receive);
|
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())) {
|
if (chat.getSenderId().equals(messageDto.getRecipientId())) {
|
||||||
// 如果发送人是当前登录用户,则把发送人与接收人颠倒
|
// 如果发送人是当前登录用户,则把发送人与接收人颠倒
|
||||||
Long recipientNo = chat.getSenderId();
|
Long recipientNo = chat.getSenderId();
|
||||||
@ -220,12 +264,22 @@ public class ChatRecordServiceImpl implements IChatRecordService {
|
|||||||
chat.setSenderName(chat.getRecipientName());
|
chat.setSenderName(chat.getRecipientName());
|
||||||
chat.setRecipientId(recipientNo);
|
chat.setRecipientId(recipientNo);
|
||||||
chat.setRecipientName(recipientName);
|
chat.setRecipientName(recipientName);
|
||||||
|
chat.setConsultationId(chat.getConsultationId());
|
||||||
}
|
}
|
||||||
chat.setUnreadCount(unReadMap.get(receive) == null ? 0 : unReadMap.get(receive));
|
}
|
||||||
|
chat.setUnreadCount(CollectionUtils.isEmpty(unreadList) ? 0 : unreadList.size());
|
||||||
messageCenterVos.add(chat);
|
messageCenterVos.add(chat);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -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));
|
||||||
|
|
||||||
@ -255,7 +305,7 @@ public class ChatRecordServiceImpl implements IChatRecordService {
|
|||||||
return chatRecordMapper.selectMegList(messageDto);
|
return chatRecordMapper.selectMegList(messageDto);
|
||||||
// 健康推送
|
// 健康推送
|
||||||
} else if(messageDto.getMessageCategory().equals("2")) {
|
} 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);
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
if (!"1".equals(jsonObject.get("code"))) {
|
if (!"1".equals(jsonObject.get("code"))) {
|
||||||
throw new ServiceException(jsonObject.get("msg").toString());
|
throw new ServiceException(jsonObject.get("msg").toString());
|
||||||
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"));
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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="com.xinelu.manage.dto.chatrecord.MarkReadDto">
|
<update id="updateReadStatus" parameterType="com.xinelu.manage.dto.chatrecord.MarkReadDto">
|
||||||
@ -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 <= #{sendTime}
|
||||||
|
</if>
|
||||||
|
<if test="messageCategory != null">
|
||||||
|
and message_category = #{messageCategory}
|
||||||
|
</if>
|
||||||
|
ORDER BY send_time desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -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>
|
||||||
Loading…
Reference in New Issue
Block a user