diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/consultationInfo/ConsultationInfoController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/consultationInfo/ConsultationInfoController.java new file mode 100644 index 0000000..c491a27 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/consultationInfo/ConsultationInfoController.java @@ -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 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(); + } + } + +} 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 new file mode 100644 index 0000000..3a98ce3 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java @@ -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(); + } +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/consultationInfo/ConsultationInfo.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/consultationInfo/ConsultationInfo.java new file mode 100644 index 0000000..54b72b4 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/consultationInfo/ConsultationInfo.java @@ -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; + + /** + * 是否删除标识,0:否,1:是 + */ + 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(); + } +} 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 new file mode 100644 index 0000000..7623c6a --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/chatRecord/ChatRecordMapper.java @@ -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 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); +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/consultationInfo/ConsultationInfoMapper.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/consultationInfo/ConsultationInfoMapper.java new file mode 100644 index 0000000..5176451 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/consultationInfo/ConsultationInfoMapper.java @@ -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 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); +} 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 new file mode 100644 index 0000000..f810486 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatRecord/IChatRecordService.java @@ -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 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); +} 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 new file mode 100644 index 0000000..f1c2f1a --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/chatRecord/impl/ChatRecordServiceImpl.java @@ -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 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); + } +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/IConsultationInfoService.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/IConsultationInfoService.java new file mode 100644 index 0000000..d40c823 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/IConsultationInfoService.java @@ -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 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); +} 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 new file mode 100644 index 0000000..49d07fb --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/consultationInfo/impl/ConsultationInfoServiceImpl.java @@ -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 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); + } +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/consultationInfo/ConsultationInfoVO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/consultationInfo/ConsultationInfoVO.java new file mode 100644 index 0000000..2ec4853 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/consultationInfo/ConsultationInfoVO.java @@ -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; + + /** + * 是否删除标识,0:否,1:是 + */ + 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(); + } +} 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 new file mode 100644 index 0000000..b2e1679 --- /dev/null +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/chatRecord/ChatRecordMapper.xml @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into chat_record + + 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, + + + + #{consultationId}, + + #{senderId}, + + #{senderName}, + + #{sendTime}, + + #{recipientId}, + + #{recipientName}, + + #{messageType}, + + #{title}, + + #{content}, + + #{contentId}, + + #{readStatus}, + + #{readTime}, + + #{delFlag}, + + #{createBy}, + + #{createTime}, + + #{updateBy}, + + #{updateTime}, + + + + + + update chat_record + + consultation_id = + #{consultationId}, + + sender_id = + #{senderId}, + + sender_name = + #{senderName}, + + send_time = + #{sendTime}, + + recipient_id = + #{recipientId}, + + recipient_name = + #{recipientName}, + + 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} + + + + update chat_record + + + + read_status = =#{readStatus}, + + + read_time = #{readTime}, + + + + where del_flag = '0' and read_status = '0' and recipient_id = #{recipientId} + + + + delete + from chat_record + where id = #{id} + + + + delete from chat_record where id in + + #{id} + + + diff --git a/xinelu-nurse-manage/src/main/resources/mapper/manage/consultationInfo/ConsultationInfoMapper.xml b/xinelu-nurse-manage/src/main/resources/mapper/manage/consultationInfo/ConsultationInfoMapper.xml new file mode 100644 index 0000000..2bc96e2 --- /dev/null +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/consultationInfo/ConsultationInfoMapper.xml @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into consultation_info + + 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, + + + + #{id}, + + #{patientId}, + + #{patientName}, + + #{cardNo}, + + #{phone}, + + #{address}, + + #{doctorId}, + + #{doctorName}, + + #{consultationType}, + + #{status}, + + #{appointmentDate}, + + #{appointmentStartTime}, + + #{appointmentEndTime}, + + #{videoUrl}, + + #{problemDescription}, + + #{situationDescription}, + + #{problemStatement}, + + #{medicalRecord}, + + #{delFlag}, + + #{createBy}, + + #{createTime}, + + #{updateBy}, + + #{updateTime}, + + + + + + update consultation_info + + patient_id = + #{patientId}, + + patient_name = + #{patientName}, + + card_no = + #{cardNo}, + + phone = + #{phone}, + + address = + #{address}, + + doctor_id = + #{doctorId}, + + doctor_name = + #{doctorName}, + + consultation_type = + #{consultationType}, + + status = + #{status}, + + appointment_date = + #{appointmentDate}, + + appointment_start_time = + #{appointmentStartTime}, + + appointment_end_time = + #{appointmentEndTime}, + + video_url = + #{videoUrl}, + + problem_description = + #{problemDescription}, + + situation_description = + #{situationDescription}, + + problem_statement = + #{problemStatement}, + + medical_record = + #{medicalRecord}, + + del_flag = + #{delFlag}, + + create_by = + #{createBy}, + + create_time = + #{createTime}, + + update_by = + #{updateBy}, + + update_time = + #{updateTime}, + + + where id = #{id} + + + + delete + from consultation_info + where id = #{id} + + + + delete from consultation_info where id in + + #{id} + + +