topics.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * 议题模型。
  3. */
  4. "use strict";
  5. let RedisClient = require('../../repository/redis/redis.client.js');
  6. let redisClient = RedisClient.redisClient();
  7. let RedisModel = require('./../redis.model.js');
  8. let modelUtil = require('../../util/modelUtil');
  9. let Participants = require("./participants");
  10. let Sessions = require("./sessions");
  11. const RedisKey = require('../../include/commons').RedisKey;
  12. class Topics extends RedisModel {
  13. constructor() {
  14. super();
  15. }
  16. /**
  17. * 根据topicId获取对应的Topics
  18. * @param topicId
  19. */
  20. getTopicsById(topicId){
  21. }
  22. /**
  23. * 根据用户ID获取用户的Topics列表
  24. * @param UserId
  25. */
  26. getUserTopics(UserId){
  27. }
  28. /**
  29. * 根据topicId获取对应的消息
  30. * @param topicId
  31. */
  32. getTopicMessages(topicId){
  33. }
  34. /**
  35. *
  36. * @param topicName 发起议题的名称
  37. * @param patient 发起议题的患者
  38. * @param doctor 参与的医生
  39. * @param messages 发送的消息对象{quesion:"",img:""}图片多个用逗号隔开
  40. */
  41. createTopics(topicName,patient,healthDoctor,doctor,messages){
  42. let self = this;
  43. let participants = new Participants();
  44. let sessions = new Sessions();
  45. //从数据库中获取sessionId
  46. participants.getSessionIdByParticipants(patient,healthDoctor,function(err,res){
  47. if (err) {
  48. modelUtil.emitDbError(self.eventEmitter, "Get group member's avatar list failed", err);
  49. return;
  50. }
  51. //如果存在的情况直接返回
  52. if(res){
  53. return res;
  54. }else{
  55. //不存在则去创建一个session
  56. }
  57. })
  58. }
  59. }
  60. // Expose class
  61. module.exports = Topics;