From 343527df23de3f64fc29f56aac6d4fbfd6ae24a3 Mon Sep 17 00:00:00 2001 From: mengkuiliang <1464081137@qq.com> Date: Wed, 25 Oct 2023 14:39:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=B6=E5=8C=BBpc=E7=AB=AF?= =?UTF-8?q?=E5=81=A5=E5=BA=B7=E7=9F=A5=E8=AF=86=E6=8E=A8=E9=80=81=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applet/FdMessageController.java | 71 ++++++++++++++ .../web/controller/fd/FDController.java | 10 +- .../applet/dto/chatrecord/ChatRecordDTO.java | 16 +++- .../dto/chatrecord/MessageSearchDto.java | 14 +++ .../mapper/chatrecord/ChatRecordMapper.java | 36 +++++++ .../chatRecord/IChatRecordService.java | 38 ++++++++ .../impl/ChatRecordServiceImpl.java | 65 +++++++++++++ .../applet/vo/chatrecord/MessageVo.java | 3 + .../applet/chatrecord/ChatRecordMapper.xml | 96 ++++++++++++++++++- .../manage/domain/chatRecord/ChatRecord.java | 5 + 10 files changed, 350 insertions(+), 4 deletions(-) diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java index a7a287a..3d9148d 100644 --- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java +++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java @@ -1,21 +1,33 @@ package com.xinelu.web.controller.applet; import com.alibaba.fastjson2.JSONObject; +import com.github.pagehelper.PageInfo; +import com.xinelu.applet.dto.chatrecord.ChatRecordDTO; +import com.xinelu.applet.dto.chatrecord.MessageSearchDto; +import com.xinelu.applet.service.chatRecord.IChatRecordService; import com.xinelu.applet.service.messagepush.MessagePushService; +import com.xinelu.applet.vo.chatrecord.MessageVo; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.R; +import com.xinelu.common.exception.ServiceException; import com.xinelu.familydoctor.applet.pojo.body.MessagePushBody; import com.xinelu.familydoctor.applet.pojo.dto.FDMessageDto; import com.xinelu.familydoctor.applet.pojo.vo.SignInfoDataVo; import com.xinelu.framework.config.AsyncExecutorConfig; +import com.xinelu.manage.domain.chatRecord.ChatRecord; +import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; +import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; +import java.util.Date; /** * @Author mengkuiliang @@ -32,6 +44,10 @@ public class FdMessageController extends BaseController { private MessagePushService messagePushService; @Resource private AsyncExecutorConfig asyncExecutorConfig; + @Resource + private IChatRecordService chatRecordService; + @Resource + private IHospitalPersonInfoService hospitalPersonInfoService; @ApiOperation(value = "家医推送订阅消息", notes = "向接收方推送订阅消息") @PostMapping("/push") @@ -77,4 +93,59 @@ public class FdMessageController extends BaseController { System.out.println("执行成功"); return R.ok(); } + + + @ApiOperation("查询通知推送列表-家医PC端") + @PostMapping("/getNoticList") + public R> getNoticList(@RequestBody MessageSearchDto messageDto) { + if (StringUtils.isBlank(messageDto.getSenderNo())) { + return R.fail("发送人编号不能为空"); + } + return R.ok(chatRecordService.getNoticList(messageDto)); + } + + @ApiOperation("查询通知详情-PC端") + @GetMapping("/getNoticDetail/{messageNo}") + public R getNoticDetail(@PathVariable String messageNo) { + return R.ok(chatRecordService.getNoticDetail(messageNo)); + } + + @ApiOperation(value = "保存通知-PC端", notes = "健康推送和通知公告消息通知") + @PostMapping("/noticeSave") + @Transactional + public R noticeSave(@RequestBody ChatRecordDTO message) { + // 根据发送人编号查询家医用户信息 + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(message.getSenderNo(), null); + if(hospitalPersonInfo == null) { + throw new ServiceException("未查询到医生信息"); + } + if(StringUtils.isBlank(message.getMessageNo())) { + message.setSendTime(new Date()); + message.setSenderId(hospitalPersonInfo.getId()); + message.setSenderName(hospitalPersonInfo.getPersonName()); + chatRecordService.insertChatRecord(message); + } else { + MessageVo messageVo = chatRecordService.getNoticDetail(message.getMessageNo()); + if(messageVo != null) { + ChatRecord entity = new ChatRecord(); + BeanUtils.copyProperties(messageVo, entity); + entity.setMessageType(message.getMessageType()); + entity.setContent(message.getContent()); + entity.setCrowds(message.getCrowds()); + entity.setCrowdsName(message.getCrowdsName()); + entity.setTitle(message.getTitle()); + entity.setUpdateTime(new Date()); + entity.setUpdateBy(message.getSenderNo()); + chatRecordService.updateChatRecordOfNo(entity); + } + } + return R.ok(); + } + + @ApiOperation("删除通知-家医PC端") + @GetMapping("/noticDel/{messageNo}") + public R noticDel(@PathVariable String messageNo) { + chatRecordService.del(messageNo); + return R.ok(); + } } diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java index 89003bf..535617d 100644 --- a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java +++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java @@ -3,6 +3,10 @@ package com.xinelu.web.controller.fd; import com.alibaba.fastjson2.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.xinelu.applet.dto.chatrecord.ChatRecordDTO; +import com.xinelu.applet.dto.chatrecord.MessageSearchDto; +import com.xinelu.applet.service.chatRecord.IChatRecordService; +import com.xinelu.applet.vo.chatrecord.MessageVo; import com.xinelu.common.core.domain.R; import com.xinelu.familydoctor.applet.pojo.body.ApprovalBody; import com.xinelu.familydoctor.applet.pojo.body.SyncHospitalPersonInfoBody; @@ -13,6 +17,7 @@ import com.xinelu.familydoctor.applet.pojo.vo.ResidentSignApplyVo; import com.xinelu.familydoctor.applet.service.IResidentRescindApplyService; import com.xinelu.familydoctor.applet.service.IResidentServiceAppletService; import com.xinelu.familydoctor.applet.service.IResidentSignAppletService; +import com.xinelu.manage.domain.chatRecord.ChatRecord; import com.xinelu.manage.domain.hospitalinfo.HospitalInfo; import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; import com.xinelu.manage.service.hospitalinfo.IHospitalInfoService; @@ -23,6 +28,9 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -45,6 +53,7 @@ public class FDController { @Resource private IHospitalInfoService hospitalInfoService; + @ApiOperation("服务申请列表") @PostMapping("/performanceBooking/list") public R> performanceBookingList(@RequestBody ApplyQuery query) { @@ -191,5 +200,4 @@ public class FDController { } return R.ok(); } - } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java index 85764b6..a9ab63a 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java @@ -2,6 +2,7 @@ package com.xinelu.applet.dto.chatrecord; import com.xinelu.common.core.domain.BaseEntity; import com.xinelu.common.custominterface.Insert; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import net.sf.jsqlparser.statement.update.Update; import org.hibernate.validator.constraints.Length; @@ -29,9 +30,9 @@ public class ChatRecordDTO extends BaseEntity implements Serializable { private Long consultationId; /** - * 发送人 + * 消息业务主键 */ - @NotNull(message = "发送人信息不能为空", groups = {Insert.class}) + @NotNull(message = "消息业务主键", groups = {Insert.class}) private String messageNo; /** @@ -40,6 +41,11 @@ public class ChatRecordDTO extends BaseEntity implements Serializable { @NotNull(message = "发送人信息不能为空", groups = {Insert.class}) private Long senderId; + /** + * 发送人(家医医生编号) + */ + private String senderNo; + /** * 发送人姓名 */ @@ -85,4 +91,10 @@ public class ChatRecordDTO extends BaseEntity implements Serializable { */ private String messageCategory; + @ApiModelProperty("通知适用人群(0:全部人群)") + private String crowds; + + @ApiModelProperty("通知适用人群名称") + private String crowdsName; + } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java index f585b5b..c85521e 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java @@ -26,6 +26,9 @@ public class MessageSearchDto { @ApiModelProperty("发送人编号") private Long senderId; + @ApiModelProperty("发送人编号(家医医生编号)") + private String senderNo; + @ApiModelProperty("接收人编号") private Long recipientId; @@ -47,6 +50,17 @@ public class MessageSearchDto { @ApiModelProperty(value = "居民绑定时间", hidden = true) private Date bindingTime; + /** + * 页码 + */ + @ApiModelProperty(value = "页码") + private Integer pageNum = 1; + /** + * 每页大小 + */ + @ApiModelProperty(value = "每页大小") + private Integer pageSize = 15; + @ApiModelProperty(value = "通知适用人群编号集合", hidden = true) private List crowdNoList; } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java index ecee67c..26b0b69 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java @@ -68,4 +68,40 @@ public interface ChatRecordMapper { public int deleteChatRecordByIds(Long[] ids); Integer updateReadStatus(MarkReadDto markReadDto); + + /** + * @Author mengkuiliang + * @Description 查询健康知识推送列表 + * @Date 2023-10-25 025 11:27 + * @Param [messageDto] + * @return java.lang.Object + **/ + List getNoticList(MessageSearchDto messageDto); + + /** + * @Author mengkuiliang + * @Description 查询消息详情 + * @Date 2023-10-25 025 11:45 + * @Param [messageNo] + * @return com.xinelu.applet.vo.chatrecord.MessageVo + **/ + MessageVo getByNo(String messageNo); + + /** + * @Author mengkuiliang + * @Description 删除通知 + * @Date 2023-10-25 025 13:15 + * @Param [messageNo] + * @return void + **/ + void del(String messageNo); + + /** + * @Author mengkuiliang + * @Description 更新通知 + * @Date 2023-10-25 025 14:05 + * @Param [entity] + * @return void + **/ + void updateChatRecordOfNo(ChatRecord entity); } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java index 4d2d1c0..99bd0fb 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java @@ -1,8 +1,10 @@ package com.xinelu.applet.service.chatRecord; +import com.github.pagehelper.PageInfo; import com.xinelu.applet.dto.chatrecord.ChatRecordDTO; import com.xinelu.applet.dto.chatrecord.MessageSearchDto; import com.xinelu.applet.vo.chatrecord.MessageCenterVo; +import com.xinelu.applet.vo.chatrecord.MessageVo; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.exception.file.InvalidExtensionException; import com.xinelu.manage.domain.chatRecord.ChatRecord; @@ -78,4 +80,40 @@ public interface IChatRecordService { public AjaxResult uploadChatRecordFile(MultipartFile multipartFile, Long consultationId) throws IOException, InvalidExtensionException; List getMegVoList(MessageSearchDto messageDto); + + /** + * @Author mengkuiliang + * @Description 查询健康知识推送列表 + * @Date 2023-10-25 025 11:24 + * @Param [messageDto] + * @return com.github.pagehelper.PageInfo + **/ + PageInfo getNoticList(MessageSearchDto messageDto); + + /** + * @Author mengkuiliang + * @Description 查询健康知识推送详情 + * @Date 2023-02-18 14:58 + * @Param [messageNo] + * @return java.lang.Object + **/ + MessageVo getNoticDetail(String messageNo); + + /** + * @Author mengkuiliang + * @Description 删除通知 + * @Date 2023-10-25 025 13:15 + * @Param [messageNo] + * @return void + **/ + void del(String messageNo); + + /** + * @Author mengkuiliang + * @Description 更新通知 + * @Date 2023-10-25 025 14:04 + * @Param [entity] + * @return void + **/ + void updateChatRecordOfNo(ChatRecord entity); } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java index 489826a..99fc7d5 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java @@ -1,5 +1,7 @@ package com.xinelu.applet.service.chatRecord.impl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.xinelu.applet.dto.chatrecord.ChatRecordDTO; import com.xinelu.applet.dto.chatrecord.MessageSearchDto; import com.xinelu.applet.mapper.chatrecord.ChatRecordMapper; @@ -8,6 +10,7 @@ import com.xinelu.applet.vo.chatrecord.MessageCenterVo; import com.xinelu.applet.vo.chatrecord.MessageVo; import com.xinelu.common.config.XinELuConfig; import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.domain.R; import com.xinelu.common.core.dto.MessageTemplate; import com.xinelu.common.enums.MessageContentType; import com.xinelu.common.exception.ServiceException; @@ -17,6 +20,7 @@ import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.file.FileUploadUtils; import com.xinelu.common.utils.file.MimeTypeUtils; +import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.manage.domain.chatRecord.ChatRecord; import java.io.IOException; import java.util.ArrayList; @@ -25,6 +29,9 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; import javax.annotation.Resource; + +import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; +import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -42,6 +49,8 @@ public class ChatRecordServiceImpl implements IChatRecordService { private ChatRecordMapper chatRecordMapper; @Resource private XinELuConfig xinYiLuConfig; + @Resource + private IHospitalPersonInfoService hospitalPersonInfoService; /** * 查询图文咨询-聊天记录 @@ -76,6 +85,7 @@ public class ChatRecordServiceImpl implements IChatRecordService { chatRecord.setCreateTime(DateUtils.getNowDate()); ChatRecord record = new ChatRecord(); BeanUtils.copyBeanProp(record, chatRecord); + record.setMessageNo(IdUtils.fastSimpleUUID()); return chatRecordMapper.insertChatRecord(record); } @@ -209,4 +219,59 @@ public class ChatRecordServiceImpl implements IChatRecordService { return messageCenterVos; } + + /** + * @Author mengkuiliang + * @Description 查询健康知识推送列表 + * @Date 2023-10-25 025 11:24 + * @Param [messageDto] + * @return com.github.pagehelper.PageInfo + **/ + @Override + public PageInfo getNoticList(MessageSearchDto messageDto) { + // 根据发送人编号查询家医用户信息 + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(messageDto.getSenderNo(), null); + if(hospitalPersonInfo == null) { + throw new ServiceException("未查询到医生信息"); + } + messageDto.setSenderId(hospitalPersonInfo.getId()); + PageHelper.startPage(messageDto.getPageNum(), messageDto.getPageSize()); + return PageInfo.of(chatRecordMapper.getNoticList(messageDto)); + } + + /** + * @return com.xinelu.mp.message.pojo.vo.MessageVo + * @Author mengkuiliang + * @Description 查询消息详情 + * @Date 2023-02-18 14:58 + * @Param [messageNo] + **/ + @Override + public MessageVo getNoticDetail(String messageNo) { + return chatRecordMapper.getByNo(messageNo); + } + + /** + * @Author mengkuiliang + * @Description 删除通知 + * @Date 2023-10-25 025 13:15 + * @Param [messageNo] + * @return void + **/ + @Override + public void del(String messageNo) { + chatRecordMapper.del(messageNo); + } + + /** + * @Author mengkuiliang + * @Description 更新通知 + * @Date 2023-10-25 025 14:05 + * @Param [entity] + * @return void + **/ + @Override + public void updateChatRecordOfNo(ChatRecord entity) { + chatRecordMapper.updateChatRecordOfNo(entity); + } } diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java index b01cca9..d495ee3 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java @@ -30,6 +30,9 @@ public class MessageVo { @ApiModelProperty("发送人编号") private Long senderId; + @ApiModelProperty("发送人编号(家医医生编号)") + private String senderNo; + @ApiModelProperty("发送人姓名") private String senderName; diff --git a/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml b/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml index e5172b4..f3be419 100644 --- a/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml +++ b/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml @@ -34,6 +34,8 @@ message_no, message_category, consultation_id, + crowds, + crowds_name, sender_id, sender_name, send_time, @@ -55,7 +57,7 @@ message_no - ,message_category,crowds,crowds_name,sender_id, + ,message_category,crowds,crowds_name,sender_id,crowds,crowds_name, sender_name,send_time,recipient_id, recipient_name,message_type,title,content,content_id, read_status @@ -117,12 +119,71 @@ where id = #{id} + + + + + + insert into chat_record message_category, + message_no, + consultation_id, crowds, @@ -165,6 +226,8 @@ #{messageCategory}, + #{messageNo}, + #{consultationId}, #{crowds}, @@ -286,6 +349,32 @@ where del_flag = '0' and read_status = '0' and recipient_id = #{recipientId} + + + update chat_record + + message_category = #{messageCategory}, + consultation_id = #{consultationId}, + crowds = #{crowds}, + crowds_name = #{crowdsName}, + 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}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where message_no = #{messageNo} + + delete from chat_record @@ -298,4 +387,9 @@ #{id} + + + + delete from chat_record where message_no = #{messageNo} + diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java index 664a888..39cb003 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/chatRecord/ChatRecord.java @@ -34,6 +34,11 @@ public class ChatRecord extends BaseEntity implements Serializable { */ private Long id; + /** + * 消息业务主键 + */ + private String messageNo; + /** * 消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知 */