Ver Fonte

患者查询群组附带最后一句信息

lrf há 1 ano atrás
pai
commit
317fda4b11
2 ficheiros alterados com 4 adições e 3 exclusões
  1. 2 3
      README.zh-CN.md
  2. 2 0
      src/service/group.service.ts

+ 2 - 3
README.zh-CN.md

@@ -10,7 +10,7 @@
   [√] 管理员登录
   [√] 医生登录
   [√] 护士登录
-  [ ] 微信小程序登录
+  [] 微信小程序登录
   [ ] 医护微信小程序绑定
 [√] 修改密码: 写login.controller里面和登录差不多就行
 [√] 解析token接口
@@ -20,6 +20,5 @@
 [√] 1.群组中找到要对话的患者: 查询群组患者时,需要将患者都换成基本信息并过滤.随后可以单查患者信息,但是不要每个患者返回大量数据
 [√] 2.患者需要查询自己所在的所有分组管理医生信息 接口
 [ ] 3.对话是 以客服的形式 一对一 对话: 所有医护都能看到患者的对话内容, 但是患者只和一个人对话(谁先对话,就谁来,暂定)
-    
     患者对群组说话,群组所关联的医护都可见,在对话时,记录说话人
-[√] 4.当与患者已经对过话后, 需要接口专门查询有对话记录的患者; 就像微信说过话后在列表里有这个人
+[√] 4.患者进入小程序后,首页查询群组,显示医生信息,还需要查询未读信息数量

+ 2 - 0
src/service/group.service.ts

@@ -69,7 +69,9 @@ export class GroupService extends BaseService<modelType> {
     for (const g of groupList) {
       const group = get(g, '_id');
       const notRead = await this.chatModel.count({ group, speaker: { $ne: paitentId }, not_read: 1 });
+      const latestChat = await this.chatModel.findOne({ group, patient: paitentId }, null, { sort: { 'meta.createdAt': -1 } });
       g['notRead'] = notRead;
+      g['chat'] = latestChat;
     }
     return groupList;
   }