图文问诊和聊天记录接口开发

This commit is contained in:
HaoWang 2023-09-25 12:21:33 +08:00
parent 940599b2f8
commit aed529079e
12 changed files with 1598 additions and 0 deletions

View File

@ -0,0 +1,110 @@
package com.xinelu.manage.controller.consultationInfo;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.socket.WebSocketUtils;
import com.xinelu.manage.domain.chatRecord.ChatRecord;
import com.xinelu.manage.domain.consultationInfo.ConsultationInfo;
import com.xinelu.manage.service.chatRecord.IChatRecordService;
import com.xinelu.manage.service.consultationInfo.IConsultationInfoService;
import com.xinelu.manage.vo.consultationInfo.ConsultationInfoVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 在线问诊-问诊信息Controller
*
* @author xinelu
* @date 2023-09-25
*/
@RestController
@RequestMapping("/system/consultationInfo")
public class ConsultationInfoController extends BaseController {
@Autowired
private IConsultationInfoService consultationInfoService;
@Autowired
private IChatRecordService chatRecordService;
/**
* 查询在线问诊-问诊信息列表
*/
//@PreAuthorize("@ss.hasPermi('system:info:list')")
@GetMapping("/list")
public TableDataInfo list(ConsultationInfo consultationInfo) {
startPage();
List<ConsultationInfoVO> list = consultationInfoService.selectConsultationInfoList(consultationInfo);
return getDataTable(list);
}
/**
* 获取在线问诊-问诊信息详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(consultationInfoService.selectConsultationInfoById(id));
}
/**
* 新增在线问诊-问诊信息
*/
// @PreAuthorize("@ss.hasPermi('system:info:add')")
@Log(title = "在线问诊-问诊信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ConsultationInfo consultationInfo) {
return toAjax(consultationInfoService.insertConsultationInfo(consultationInfo));
}
/**
* 修改在线问诊-问诊信息(修改问诊状态)
*/
// @PreAuthorize("@ss.hasPermi('system:info:edit')")
@Log(title = "在线问诊-问诊信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ConsultationInfo consultationInfo) {
return toAjax(consultationInfoService.updateConsultationInfo(consultationInfo));
}
/**
* 查询聊天记录
*/
@GetMapping("/getChatRecord")
public AjaxResult getChatRecord(ChatRecord chatRecord) {
return AjaxResult.success(chatRecordService.selectChatRecordList(chatRecord));
}
/**
* 修改已读状态
*/
@Log(title = "图文咨询-聊天记录", businessType = BusinessType.UPDATE)
@PutMapping(value = "updateReadStatus")
public AjaxResult updateReadStatus(@RequestBody ChatRecord chatRecord) {
return toAjax(chatRecordService.updateChatRecord(chatRecord));
}
@ApiOperation(value = "发送即时消息", notes = "向接收方发送即时消息")
@PostMapping("/sendMessage")
@Transactional
public AjaxResult sendMessage(@RequestBody ChatRecord chatRecord) {
if (chatRecordService.insertChatRecord(chatRecord) > 0) {
// 判断接收人是否在线
if (WebSocketUtils.clients.get(chatRecord.getRecipientId().toString()) == null) {
return AjaxResult.success();
} else {
return chatRecordService.sendMessage(chatRecord) ? AjaxResult.success() : AjaxResult.error();
}
} else {
return AjaxResult.success();
}
}
}

View File

@ -0,0 +1,149 @@
package com.xinelu.manage.domain.chatRecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 图文咨询-聊天记录对象 chat_record
*
* @author xinelu
* @date 2023-09-25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "图文咨询-聊天记录对象", description = "chat_record")
public class ChatRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 自增主键
*/
private Long id;
/**
* 聊天记录业务主键(问诊表id)
*/
private Long consultationId;
/**
* 发送人
*/
@ApiModelProperty(value = "发送人")
@Excel(name = "发送人")
private Long senderId;
/**
* 发送人姓名
*/
@ApiModelProperty(value = "发送人姓名")
@Excel(name = "发送人姓名")
private String senderName;
/**
* 发送时间时间格式yyyy-MM-dd HH:mm:ss
*/
@ApiModelProperty(value = "发送时间时间格式yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发送时间时间格式yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
private Date sendTime;
/**
* 接收人
*/
@ApiModelProperty(value = "接收人")
@Excel(name = "接收人")
private Long recipientId;
/**
* 接收人姓名
*/
@ApiModelProperty(value = "接收人姓名")
@Excel(name = "接收人姓名")
private String recipientName;
/**
* 消息类型(0其他 1文字2图片 3表情 4视频 5文件 6链接)
*/
@ApiModelProperty(value = "消息类型(0其他 1文字2图片 3表情 4视频 5文件 6链接)")
@Excel(name = "消息类型(0其他 1文字2图片 3表情 4视频 5文件 6链接)")
private String messageType;
/**
* 标题
*/
@ApiModelProperty(value = "标题")
@Excel(name = "标题")
private String title;
/**
* 消息内容图片内容时内容为图片路径
*/
@ApiModelProperty(value = "消息内容,图片内容时内容为:图片路径")
@Excel(name = "消息内容,图片内容时内容为:图片路径")
private String content;
/**
* 消息内容业务主键用于点击跳转
*/
@ApiModelProperty(value = "消息内容业务主键,用于点击跳转")
@Excel(name = "消息内容业务主键,用于点击跳转")
private String contentId;
/**
* 已读状态0未读1已读
*/
@ApiModelProperty(value = "已读状态0未读1已读")
@Excel(name = "已读状态0未读1已读")
private String readStatus;
/**
* 阅读时间时间格式yyyy-MM-dd HH:mm:ss
*/
@ApiModelProperty(value = "阅读时间时间格式yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "阅读时间时间格式yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
private Date readTime;
/**
* 删除状态0未删除1已删除
*/
private Integer delFlag;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("consultationId", getConsultationId())
.append("senderId", getSenderId())
.append("senderName", getSenderName())
.append("sendTime", getSendTime())
.append("recipientId", getRecipientId())
.append("recipientName", getRecipientName())
.append("messageType", getMessageType())
.append("title", getTitle())
.append("content", getContent())
.append("contentId", getContentId())
.append("readStatus", getReadStatus())
.append("readTime", getReadTime())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,192 @@
package com.xinelu.manage.domain.consultationInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 在线问诊-问诊信息图文和视频问诊基本信息对象 consultation_info
*
* @author xinelu
* @date 2023-09-25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "在线问诊-问诊信息(图文和视频问诊基本信息)对象", description = "consultation_info")
public class ConsultationInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Long id;
/**
* 患者id
*/
@ApiModelProperty(value = "患者id")
@Excel(name = "患者id")
private Long patientId;
/**
* 患者名称
*/
@ApiModelProperty(value = "患者名称")
@Excel(name = "患者名称")
private String patientName;
/**
* 患者身份证号
*/
@ApiModelProperty(value = "患者身份证号")
@Excel(name = "患者身份证号")
private String cardNo;
/**
* 患者联系方式
*/
@ApiModelProperty(value = "患者联系方式")
@Excel(name = "患者联系方式")
private String phone;
/**
* 现住址所在地区
*/
@ApiModelProperty(value = "现住址所在地区")
@Excel(name = "现住址所在地区")
private String address;
/**
* 医生id(签约医生/专家)
*/
@ApiModelProperty(value = "医生id(签约医生/专家)")
@Excel(name = "医生id(签约医生/专家)")
private String doctorId;
/**
* 医生名称
*/
@ApiModelProperty(value = "医生名称")
@Excel(name = "医生名称")
private String doctorName;
/**
* 问诊类型图文问诊IMAGE_TEXT_CONSULTATION视频问诊VIDEO_CONSULTATION
*/
@ApiModelProperty(value = "问诊类型图文问诊IMAGE_TEXT_CONSULTATION视频问诊VIDEO_CONSULTATION")
@Excel(name = "问诊类型图文问诊IMAGE_TEXT_CONSULTATION视频问诊VIDEO_CONSULTATION")
private String consultationType;
/**
* 状态(1 未完成 ,2 已完成)
*/
@ApiModelProperty(value = "状态(1 未完成 ,2 已完成)")
@Excel(name = "状态(1 未完成 ,2 已完成)")
private Integer status;
/**
* 预约日期(视频问诊预约)时间格式yyyy-MM-dd
*/
@ApiModelProperty(value = "预约日期(视频问诊预约)时间格式yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "预约日期(视频问诊预约)时间格式yyyy-MM-dd", width = 30, dateFormat = "yyyy-MM-dd")
private Date appointmentDate;
/**
* 预约开始时间点(视频问诊预约)时间格式HH:mm
*/
@ApiModelProperty(value = "预约开始时间点(视频问诊预约)时间格式HH:mm")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "预约开始时间点(视频问诊预约)时间格式HH:mm", width = 30, dateFormat = "yyyy-MM-dd")
private Date appointmentStartTime;
/**
* 预约结束时间点(视频问诊预约)时间格式HH:mm
*/
@ApiModelProperty(value = "预约结束时间点(视频问诊预约)时间格式HH:mm")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "预约结束时间点(视频问诊预约)时间格式HH:mm", width = 30, dateFormat = "yyyy-MM-dd")
private Date appointmentEndTime;
/**
* 视频问诊地址
*/
@ApiModelProperty(value = "视频问诊地址")
@Excel(name = "视频问诊地址")
private String videoUrl;
/**
* 问题简述
*/
@ApiModelProperty(value = "问题简述")
@Excel(name = "问题简述")
private String problemDescription;
/**
* 患者个体情况说明
*/
@ApiModelProperty(value = "患者个体情况说明")
@Excel(name = "患者个体情况说明")
private String situationDescription;
/**
* 问题描述
*/
@ApiModelProperty(value = "问题描述")
@Excel(name = "问题描述")
private String problemStatement;
/**
* 病历
*/
@ApiModelProperty(value = "病历")
@Excel(name = "病历")
private String medicalRecord;
/**
* 是否删除标识01
*/
private Integer delFlag;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("patientId", getPatientId())
.append("patientName", getPatientName())
.append("cardNo", getCardNo())
.append("phone", getPhone())
.append("address", getAddress())
.append("doctorId", getDoctorId())
.append("doctorName", getDoctorName())
.append("consultationType", getConsultationType())
.append("status", getStatus())
.append("appointmentDate", getAppointmentDate())
.append("appointmentStartTime", getAppointmentStartTime())
.append("appointmentEndTime", getAppointmentEndTime())
.append("videoUrl", getVideoUrl())
.append("problemDescription", getProblemDescription())
.append("situationDescription", getSituationDescription())
.append("problemStatement", getProblemStatement())
.append("medicalRecord", getMedicalRecord())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.xinelu.manage.mapper.chatRecord;
import com.xinelu.manage.domain.chatRecord.ChatRecord;
import java.util.List;
/**
* 图文咨询-聊天记录Mapper接口
*
* @author xinelu
* @date 2023-09-25
*/
public interface ChatRecordMapper {
/**
* 查询图文咨询-聊天记录
*
* @param id 图文咨询-聊天记录主键
* @return 图文咨询-聊天记录
*/
public ChatRecord selectChatRecordById(Long id);
/**
* 查询图文咨询-聊天记录列表
*
* @param chatRecord 图文咨询-聊天记录
* @return 图文咨询-聊天记录集合
*/
public List<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
/**
* 新增图文咨询-聊天记录
*
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
public int insertChatRecord(ChatRecord chatRecord);
/**
* 修改图文咨询-聊天记录
*
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
public int updateChatRecord(ChatRecord chatRecord);
/**
* 删除图文咨询-聊天记录
*
* @param id 图文咨询-聊天记录主键
* @return 结果
*/
public int deleteChatRecordById(Long id);
/**
* 批量删除图文咨询-聊天记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteChatRecordByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.xinelu.manage.mapper.consultationInfo;
import com.xinelu.manage.domain.consultationInfo.ConsultationInfo;
import com.xinelu.manage.vo.consultationInfo.ConsultationInfoVO;
import java.util.List;
/**
* 在线问诊-问诊信息图文和视频问诊基本信息Mapper接口
*
* @author xinelu
* @date 2023-09-25
*/
public interface ConsultationInfoMapper {
/**
* 查询在线问诊-问诊信息图文和视频问诊基本信息
*
* @param id 在线问诊-问诊信息图文和视频问诊基本信息主键
* @return 在线问诊-问诊信息图文和视频问诊基本信息
*/
public ConsultationInfo selectConsultationInfoById(Long id);
/**
* 查询在线问诊-问诊信息图文和视频问诊基本信息列表
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 在线问诊-问诊信息图文和视频问诊基本信息集合
*/
public List<ConsultationInfoVO> selectConsultationInfoList(ConsultationInfo consultationInfo);
/**
* 新增在线问诊-问诊信息图文和视频问诊基本信息
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 结果
*/
public int insertConsultationInfo(ConsultationInfo consultationInfo);
/**
* 修改在线问诊-问诊信息图文和视频问诊基本信息
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 结果
*/
public int updateConsultationInfo(ConsultationInfo consultationInfo);
/**
* 删除在线问诊-问诊信息图文和视频问诊基本信息
*
* @param id 在线问诊-问诊信息图文和视频问诊基本信息主键
* @return 结果
*/
public int deleteConsultationInfoById(Long id);
/**
* 批量删除在线问诊-问诊信息图文和视频问诊基本信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteConsultationInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,64 @@
package com.xinelu.manage.service.chatRecord;
import com.xinelu.manage.domain.chatRecord.ChatRecord;
import java.util.List;
/**
* 图文咨询-聊天记录Service接口
*
* @author xinelu
* @date 2023-09-25
*/
public interface IChatRecordService {
/**
* 查询图文咨询-聊天记录
*
* @param id 图文咨询-聊天记录主键
* @return 图文咨询-聊天记录
*/
public ChatRecord selectChatRecordById(Long id);
/**
* 查询图文咨询-聊天记录列表
*
* @param chatRecord 图文咨询-聊天记录
* @return 图文咨询-聊天记录集合
*/
public List<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
/**
* 新增图文咨询-聊天记录
*
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
public int insertChatRecord(ChatRecord chatRecord);
Boolean sendMessage(ChatRecord chatRecord);
/**
* 修改图文咨询-聊天记录
*
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
public int updateChatRecord(ChatRecord chatRecord);
/**
* 批量删除图文咨询-聊天记录
*
* @param ids 需要删除的图文咨询-聊天记录主键集合
* @return 结果
*/
public int deleteChatRecordByIds(Long[] ids);
/**
* 删除图文咨询-聊天记录信息
*
* @param id 图文咨询-聊天记录主键
* @return 结果
*/
public int deleteChatRecordById(Long id);
}

View File

@ -0,0 +1,108 @@
package com.xinelu.manage.service.chatRecord.impl;
import com.xinelu.common.core.dto.MessageTemplate;
import com.xinelu.common.enums.MessageContentType;
import com.xinelu.common.socket.WebSocketUtils;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.manage.domain.chatRecord.ChatRecord;
import com.xinelu.manage.mapper.chatRecord.ChatRecordMapper;
import com.xinelu.manage.service.chatRecord.IChatRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 图文咨询-聊天记录Service业务层处理
*
* @author xinelu
* @date 2023-09-25
*/
@Service
public class ChatRecordServiceImpl implements IChatRecordService {
@Resource
private ChatRecordMapper chatRecordMapper;
/**
* 查询图文咨询-聊天记录
*
* @param id 图文咨询-聊天记录主键
* @return 图文咨询-聊天记录
*/
@Override
public ChatRecord selectChatRecordById(Long id) {
return chatRecordMapper.selectChatRecordById(id);
}
/**
* 查询图文咨询-聊天记录列表
*
* @param chatRecord 图文咨询-聊天记录
* @return 图文咨询-聊天记录
*/
@Override
public List<ChatRecord> selectChatRecordList(ChatRecord chatRecord) {
return chatRecordMapper.selectChatRecordList(chatRecord);
}
/**
* 新增图文咨询-聊天记录
*
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
@Override
public int insertChatRecord(ChatRecord chatRecord) {
chatRecord.setCreateTime(DateUtils.getNowDate());
return chatRecordMapper.insertChatRecord(chatRecord);
}
@Override
public Boolean sendMessage(ChatRecord chatRecord) {
// 构建消息结构
MessageTemplate msg = new MessageTemplate();
msg.setMessage(chatRecord.getContent());
msg.setFromKey(chatRecord.getSenderId().toString());
msg.setToKey(chatRecord.getRecipientId().toString());
msg.setMsgType(MessageContentType.CHAT.name());
msg.setSendTime(chatRecord.getSendTime());
return WebSocketUtils.sendMessage(chatRecord.getRecipientId().toString(), msg);
}
/**
* 修改图文咨询-聊天记录
*
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
@Override
public int updateChatRecord(ChatRecord chatRecord) {
//更新已读时间
chatRecord.setReadTime(DateUtils.getNowDate());
chatRecord.setReadStatus("1");
return chatRecordMapper.updateChatRecord(chatRecord);
}
/**
* 批量删除图文咨询-聊天记录
*
* @param ids 需要删除的图文咨询-聊天记录主键
* @return 结果
*/
@Override
public int deleteChatRecordByIds(Long[] ids) {
return chatRecordMapper.deleteChatRecordByIds(ids);
}
/**
* 删除图文咨询-聊天记录信息
*
* @param id 图文咨询-聊天记录主键
* @return 结果
*/
@Override
public int deleteChatRecordById(Long id) {
return chatRecordMapper.deleteChatRecordById(id);
}
}

View File

@ -0,0 +1,63 @@
package com.xinelu.manage.service.consultationInfo;
import com.xinelu.manage.domain.consultationInfo.ConsultationInfo;
import com.xinelu.manage.vo.consultationInfo.ConsultationInfoVO;
import java.util.List;
/**
* 在线问诊-问诊信息图文和视频问诊基本信息Service接口
*
* @author xinelu
* @date 2023-09-25
*/
public interface IConsultationInfoService {
/**
* 查询在线问诊-问诊信息图文和视频问诊基本信息
*
* @param id 在线问诊-问诊信息图文和视频问诊基本信息主键
* @return 在线问诊-问诊信息图文和视频问诊基本信息
*/
public ConsultationInfo selectConsultationInfoById(Long id);
/**
* 查询在线问诊-问诊信息图文和视频问诊基本信息列表
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 在线问诊-问诊信息图文和视频问诊基本信息集合
*/
public List<ConsultationInfoVO> selectConsultationInfoList(ConsultationInfo consultationInfo);
/**
* 新增在线问诊-问诊信息图文和视频问诊基本信息
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 结果
*/
public int insertConsultationInfo(ConsultationInfo consultationInfo);
/**
* 修改在线问诊-问诊信息图文和视频问诊基本信息
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 结果
*/
public int updateConsultationInfo(ConsultationInfo consultationInfo);
/**
* 批量删除在线问诊-问诊信息图文和视频问诊基本信息
*
* @param ids 需要删除的在线问诊-问诊信息图文和视频问诊基本信息主键集合
* @return 结果
*/
public int deleteConsultationInfoByIds(Long[] ids);
/**
* 删除在线问诊-问诊信息图文和视频问诊基本信息信息
*
* @param id 在线问诊-问诊信息图文和视频问诊基本信息主键
* @return 结果
*/
public int deleteConsultationInfoById(Long id);
}

View File

@ -0,0 +1,92 @@
package com.xinelu.manage.service.consultationInfo.impl;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.manage.domain.consultationInfo.ConsultationInfo;
import com.xinelu.manage.mapper.consultationInfo.ConsultationInfoMapper;
import com.xinelu.manage.service.consultationInfo.IConsultationInfoService;
import com.xinelu.manage.vo.consultationInfo.ConsultationInfoVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 在线问诊-问诊信息图文和视频问诊基本信息Service业务层处理
*
* @author xinelu
* @date 2023-09-25
*/
@Service
public class ConsultationInfoServiceImpl implements IConsultationInfoService {
@Resource
private ConsultationInfoMapper consultationInfoMapper;
/**
* 查询在线问诊-问诊信息图文和视频问诊基本信息
*
* @param id 在线问诊-问诊信息图文和视频问诊基本信息主键
* @return 在线问诊-问诊信息图文和视频问诊基本信息
*/
@Override
public ConsultationInfo selectConsultationInfoById(Long id) {
return consultationInfoMapper.selectConsultationInfoById(id);
}
/**
* 查询在线问诊-问诊信息图文和视频问诊基本信息列表
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 在线问诊-问诊信息图文和视频问诊基本信息
*/
@Override
public List<ConsultationInfoVO> selectConsultationInfoList(ConsultationInfo consultationInfo) {
return consultationInfoMapper.selectConsultationInfoList(consultationInfo);
}
/**
* 新增在线问诊-问诊信息图文和视频问诊基本信息
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 结果
*/
@Override
public int insertConsultationInfo(ConsultationInfo consultationInfo) {
consultationInfo.setCreateTime(DateUtils.getNowDate());
return consultationInfoMapper.insertConsultationInfo(consultationInfo);
}
/**
* 修改在线问诊-问诊信息图文和视频问诊基本信息
*
* @param consultationInfo 在线问诊-问诊信息图文和视频问诊基本信息
* @return 结果
*/
@Override
public int updateConsultationInfo(ConsultationInfo consultationInfo) {
consultationInfo.setUpdateTime(DateUtils.getNowDate());
return consultationInfoMapper.updateConsultationInfo(consultationInfo);
}
/**
* 批量删除在线问诊-问诊信息图文和视频问诊基本信息
*
* @param ids 需要删除的在线问诊-问诊信息图文和视频问诊基本信息主键
* @return 结果
*/
@Override
public int deleteConsultationInfoByIds(Long[] ids) {
return consultationInfoMapper.deleteConsultationInfoByIds(ids);
}
/**
* 删除在线问诊-问诊信息图文和视频问诊基本信息信息
*
* @param id 在线问诊-问诊信息图文和视频问诊基本信息主键
* @return 结果
*/
@Override
public int deleteConsultationInfoById(Long id) {
return consultationInfoMapper.deleteConsultationInfoById(id);
}
}

View File

@ -0,0 +1,157 @@
package com.xinelu.manage.vo.consultationInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
import java.util.Date;
/**
* 在线问诊-问诊信息对象 consultation_info
*
* @author xinelu
* @date 2023-09-25
*/
@Data
public class ConsultationInfoVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Long id;
/**
* 患者id
*/
private Long patientId;
/**
* 患者名称
*/
private String patientName;
/**
* 患者身份证号
*/
private String cardNo;
/**
* 患者联系方式
*/
private String phone;
/**
* 现住址所在地区
*/
private String address;
/**
* 医生id(签约医生/专家)
*/
private String doctorId;
/**
* 医生名称
*/
private String doctorName;
/**
* 问诊类型图文问诊IMAGE_TEXT_CONSULTATION视频问诊VIDEO_CONSULTATION
*/
private String consultationType;
/**
* 状态(1 未完成 ,2 已完成)
*/
private Integer status;
/**
* 预约日期(视频问诊预约)时间格式yyyy-MM-dd
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date appointmentDate;
/**
* 预约开始时间点(视频问诊预约)时间格式HH:mm
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date appointmentStartTime;
/**
* 预约结束时间点(视频问诊预约)时间格式HH:mm
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date appointmentEndTime;
/**
* 视频问诊地址
*/
private String videoUrl;
/**
* 问题简述
*/
private String problemDescription;
/**
* 患者个体情况说明
*/
private String situationDescription;
/**
* 问题描述
*/
private String problemStatement;
/**
* 病历
*/
private String medicalRecord;
/**
* 是否删除标识01
*/
private Integer delFlag;
/**
* 消息数量
*/
private Integer messageCount;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("patientId", getPatientId())
.append("patientName", getPatientName())
.append("cardNo", getCardNo())
.append("phone", getPhone())
.append("address", getAddress())
.append("doctorId", getDoctorId())
.append("doctorName", getDoctorName())
.append("consultationType", getConsultationType())
.append("status", getStatus())
.append("appointmentDate", getAppointmentDate())
.append("appointmentStartTime", getAppointmentStartTime())
.append("appointmentEndTime", getAppointmentEndTime())
.append("videoUrl", getVideoUrl())
.append("problemDescription", getProblemDescription())
.append("situationDescription", getSituationDescription())
.append("problemStatement", getProblemStatement())
.append("medicalRecord", getMedicalRecord())
.append("delFlag", getDelFlag())
.append("messageCount", getMessageCount())
.toString();
}
}

View File

@ -0,0 +1,233 @@
<?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.chatRecord.ChatRecordMapper">
<resultMap type="ChatRecord" id="ChatRecordResult">
<result property="id" column="id"/>
<result property="consultationId" column="consultation_id"/>
<result property="senderId" column="sender_id"/>
<result property="senderName" column="sender_name"/>
<result property="sendTime" column="send_time"/>
<result property="recipientId" column="recipient_id"/>
<result property="recipientName" column="recipient_name"/>
<result property="messageType" column="message_type"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="contentId" column="content_id"/>
<result property="readStatus" column="read_status"/>
<result property="readTime" column="read_time"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectChatRecordVo">
select id,
consultation_id,
sender_id,
sender_name,
send_time,
recipient_id,
recipient_name,
message_type,
title,
content,
content_id,
read_status,
read_time,
del_flag,
create_by,
create_time,
update_by,
update_time
from chat_record
</sql>
<select id="selectChatRecordList" parameterType="ChatRecord" resultMap="ChatRecordResult">
<include refid="selectChatRecordVo"/>
where del_flag = '0'
and consultation_id = #{consultationId}
and (
(sender_id = #{senderId} and recipient_id = #{recipientId})
or
(sender_id = #{recipientId} and recipient_id = #{senderId})
)
<if test="readStatus != null">
and read_status = #{readStatus}
</if>
order by send_time
</select>
<select id="selectChatRecordById" parameterType="Long"
resultMap="ChatRecordResult">
<include refid="selectChatRecordVo"/>
where id = #{id}
</select>
<insert id="insertChatRecord" parameterType="ChatRecord" useGeneratedKeys="true"
keyProperty="id">
insert into chat_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="consultationId != null">consultation_id,
</if>
<if test="senderId != null">sender_id,
</if>
<if test="senderName != null and senderName != ''">sender_name,
</if>
<if test="sendTime != null">send_time,
</if>
<if test="recipientId != null">recipient_id,
</if>
<if test="recipientName != null and recipientName != ''">recipient_name,
</if>
<if test="messageType != null">message_type,
</if>
<if test="title != null">title,
</if>
<if test="content != null">content,
</if>
<if test="contentId != null">content_id,
</if>
<if test="readStatus != null">read_status,
</if>
<if test="readTime != null">read_time,
</if>
<if test="delFlag != null">del_flag,
</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="consultationId != null">#{consultationId},
</if>
<if test="senderId != null">#{senderId},
</if>
<if test="senderName != null and senderName != ''">#{senderName},
</if>
<if test="sendTime != null">#{sendTime},
</if>
<if test="recipientId != null">#{recipientId},
</if>
<if test="recipientName != null and recipientName != ''">#{recipientName},
</if>
<if test="messageType != null">#{messageType},
</if>
<if test="title != null">#{title},
</if>
<if test="content != null">#{content},
</if>
<if test="contentId != null">#{contentId},
</if>
<if test="readStatus != null">#{readStatus},
</if>
<if test="readTime != null">#{readTime},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateChatRecord" parameterType="ChatRecord">
update chat_record
<trim prefix="SET" suffixOverrides=",">
<if test="consultationId != null">consultation_id =
#{consultationId},
</if>
<if test="senderId != null">sender_id =
#{senderId},
</if>
<if test="senderName != null and senderName != ''">sender_name =
#{senderName},
</if>
<if test="sendTime != null">send_time =
#{sendTime},
</if>
<if test="recipientId != null">recipient_id =
#{recipientId},
</if>
<if test="recipientName != null and recipientName != ''">recipient_name =
#{recipientName},
</if>
<if test="messageType != null">message_type =
#{messageType},
</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 id="updateReadStatus" parameterType="ChatRecord">
update chat_record
<trim prefix="SET" suffixOverrides=",">
<if test="readStatus != null and readStatus != ''">
read_status = =#{readStatus},
</if>
<if test="readTime != null">
read_time = #{readTime},
</if>
</trim>
where del_flag = '0' and read_status = '0' and recipient_id = #{recipientId}
</update>
<delete id="deleteChatRecordById" parameterType="Long">
delete
from chat_record
where id = #{id}
</delete>
<delete id="deleteChatRecordByIds" parameterType="String">
delete from chat_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,305 @@
<?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.consultationInfo.ConsultationInfoMapper">
<resultMap type="ConsultationInfo" id="ConsultationInfoResult">
<result property="id" column="id"/>
<result property="patientId" column="patient_id"/>
<result property="patientName" column="patient_name"/>
<result property="cardNo" column="card_no"/>
<result property="phone" column="phone"/>
<result property="address" column="address"/>
<result property="doctorId" column="doctor_id"/>
<result property="doctorName" column="doctor_name"/>
<result property="consultationType" column="consultation_type"/>
<result property="status" column="status"/>
<result property="appointmentDate" column="appointment_date"/>
<result property="appointmentStartTime" column="appointment_start_time"/>
<result property="appointmentEndTime" column="appointment_end_time"/>
<result property="videoUrl" column="video_url"/>
<result property="problemDescription" column="problem_description"/>
<result property="situationDescription" column="situation_description"/>
<result property="problemStatement" column="problem_statement"/>
<result property="medicalRecord" column="medical_record"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectConsultationInfoVo">
select id,
patient_id,
patient_name,
card_no,
phone,
address,
doctor_id,
doctor_name,
consultation_type,
status,
appointment_date,
appointment_start_time,
appointment_end_time,
video_url,
problem_description,
situation_description,
problem_statement,
medical_record,
del_flag,
create_by,
create_time,
update_by,
update_time
from consultation_info
</sql>
<select id="selectConsultationInfoList" parameterType="ConsultationInfo" resultType="com.xinelu.manage.vo.consultationInfo.ConsultationInfoVO">
SELECT
ci.id,
ci.patient_id,
ci.patient_name,
ci.card_no,
ci.phone,
ci.address,
ci.doctor_id,
ci.doctor_name,
ci.problem_description,
COUNT(cr.id) as messageCount
FROM
consultation_info ci
LEFT JOIN chat_record cr ON cr.consultation_id=ci.id AND read_status='0'
<if test="patientId != null ">
and sender_id= ci.doctor_id
</if>
<if test="doctorId != null ">
and sender_id= ci.patient_id
</if>
<where>
<if test="patientId != null ">
and ci.patient_id = #{patientId}
</if>
<if test="patientName != null and patientName != ''">
and ci.patient_name like concat('%', #{patientName}, '%')
</if>
<if test="doctorId != null and doctorId != ''">
and ci.doctor_id = #{doctorId}
</if>
<if test="doctorName != null and doctorName != ''">
and ci.doctor_name like concat('%', #{doctorName}, '%')
</if>
<if test="consultationType != null and consultationType != ''">
and ci.consultation_type = #{consultationType}
</if>
<if test="status != null ">
and ci.status = #{status}
</if>
<if test="appointmentDate != null ">
and ci.appointment_date = #{appointmentDate}
</if>
<if test="appointmentStartTime != null ">
and ci.appointment_start_time = #{appointmentStartTime}
</if>
<if test="appointmentEndTime != null ">
and ci.appointment_end_time = #{appointmentEndTime}
</if>
</where>
ORDER BY ci.create_time DESC
</select>
<select id="selectConsultationInfoById" parameterType="Long"
resultMap="ConsultationInfoResult">
<include refid="selectConsultationInfoVo"/>
where id = #{id}
</select>
<insert id="insertConsultationInfo" parameterType="ConsultationInfo">
insert into consultation_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,
</if>
<if test="patientId != null">patient_id,
</if>
<if test="patientName != null">patient_name,
</if>
<if test="cardNo != null">card_no,
</if>
<if test="phone != null">phone,
</if>
<if test="address != null">address,
</if>
<if test="doctorId != null">doctor_id,
</if>
<if test="doctorName != null">doctor_name,
</if>
<if test="consultationType != null">consultation_type,
</if>
<if test="status != null">status,
</if>
<if test="appointmentDate != null">appointment_date,
</if>
<if test="appointmentStartTime != null">appointment_start_time,
</if>
<if test="appointmentEndTime != null">appointment_end_time,
</if>
<if test="videoUrl != null">video_url,
</if>
<if test="problemDescription != null">problem_description,
</if>
<if test="situationDescription != null">situation_description,
</if>
<if test="problemStatement != null">problem_statement,
</if>
<if test="medicalRecord != null">medical_record,
</if>
<if test="delFlag != null">del_flag,
</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},
</if>
<if test="patientId != null">#{patientId},
</if>
<if test="patientName != null">#{patientName},
</if>
<if test="cardNo != null">#{cardNo},
</if>
<if test="phone != null">#{phone},
</if>
<if test="address != null">#{address},
</if>
<if test="doctorId != null">#{doctorId},
</if>
<if test="doctorName != null">#{doctorName},
</if>
<if test="consultationType != null">#{consultationType},
</if>
<if test="status != null">#{status},
</if>
<if test="appointmentDate != null">#{appointmentDate},
</if>
<if test="appointmentStartTime != null">#{appointmentStartTime},
</if>
<if test="appointmentEndTime != null">#{appointmentEndTime},
</if>
<if test="videoUrl != null">#{videoUrl},
</if>
<if test="problemDescription != null">#{problemDescription},
</if>
<if test="situationDescription != null">#{situationDescription},
</if>
<if test="problemStatement != null">#{problemStatement},
</if>
<if test="medicalRecord != null">#{medicalRecord},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateConsultationInfo" parameterType="ConsultationInfo">
update consultation_info
<trim prefix="SET" suffixOverrides=",">
<if test="patientId != null">patient_id =
#{patientId},
</if>
<if test="patientName != null">patient_name =
#{patientName},
</if>
<if test="cardNo != null">card_no =
#{cardNo},
</if>
<if test="phone != null">phone =
#{phone},
</if>
<if test="address != null">address =
#{address},
</if>
<if test="doctorId != null">doctor_id =
#{doctorId},
</if>
<if test="doctorName != null">doctor_name =
#{doctorName},
</if>
<if test="consultationType != null">consultation_type =
#{consultationType},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="appointmentDate != null">appointment_date =
#{appointmentDate},
</if>
<if test="appointmentStartTime != null">appointment_start_time =
#{appointmentStartTime},
</if>
<if test="appointmentEndTime != null">appointment_end_time =
#{appointmentEndTime},
</if>
<if test="videoUrl != null">video_url =
#{videoUrl},
</if>
<if test="problemDescription != null">problem_description =
#{problemDescription},
</if>
<if test="situationDescription != null">situation_description =
#{situationDescription},
</if>
<if test="problemStatement != null">problem_statement =
#{problemStatement},
</if>
<if test="medicalRecord != null">medical_record =
#{medicalRecord},
</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>
<delete id="deleteConsultationInfoById" parameterType="Long">
delete
from consultation_info
where id = #{id}
</delete>
<delete id="deleteConsultationInfoByIds" parameterType="String">
delete from consultation_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>