chats.endpoint.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /**
  2. * 消息端点。
  3. *
  4. * 此控制器处理点对点,组及消息消息。为三类消息提供发送及查询功能。
  5. */
  6. "use strict";
  7. let express = require('express');
  8. let router = express.Router();
  9. let http = require('http');
  10. let log = require('../util/log.js');
  11. let objectUtil = require("../util/objectUtil.js");
  12. let controllerUtil = require('../util/controllerUtil');
  13. let Patient = require("../models/patient");
  14. let Doctor = require('../models/doctor');
  15. let Group = require('../models/group');
  16. let Search = require('../models/search');
  17. const APIv1 = require('../include/endpoints').APIv1;
  18. const CONTENT_TYPES = require('../include/commons').CONTENT_TYPE;
  19. const MAX_INT = require('../include/commons').MAX_INT;
  20. const DEFAULT_PAGE_SIZE = require('../include/commons').DEFAULT_PAGE_SIZE;
  21. //--------------------------------------------------------------//
  22. //----------------------------消息发送----------------------------//
  23. //--------------------------------------------------------------//
  24. /**
  25. * 发送System消息。
  26. *
  27. * 请求URL:
  28. * /chats/sm
  29. *
  30. * 消息格式:
  31. * {
  32. * to: "Rose",
  33. * title: "System Message",
  34. * summary: "You have new job",
  35. * contentType: "1",
  36. * content: "The patient has been followed in the scheduler, please make new follow plan as soon as possible.",
  37. * delay: 986123465
  38. * }
  39. *
  40. * @param message
  41. */
  42. router.post(APIv1.Chats.SM, function (req, res) {
  43. // 检查消息体及消息格式是否正确
  44. let message = req.body;
  45. if (!objectUtil.isJsonObject(message)) {
  46. throw {httpStatus: 406, message: 'Problems parsing JSON.'}
  47. }
  48. // 字段判断
  49. let testing = objectUtil.fieldsCheck(message, "to", "title", "summary", "contentType", "content");
  50. if (!testing.pass) {
  51. throw {httpStatus: 406, message: testing.message}
  52. }
  53. // 消息处理
  54. let doctor = new Doctor();
  55. controllerUtil.regModelEventHandler(doctor, res);
  56. doctor.sendSystemMessage(message);
  57. });
  58. /**
  59. * 处理Private消息。处理流程分:
  60. * 1 解析消息,并保存到数据库
  61. * 2 更新消息统计数据
  62. * 3 获取目标的状态并构建通知消息,如果用户在线就推送通知消息
  63. *
  64. * 请求URL:
  65. * /chats/pm
  66. *
  67. * 消息格式:
  68. * {
  69. * from: sand,
  70. * to: Rose,
  71. * contentType: "1,2,3,4",
  72. * content: "Please follow the patient as soon as possible."
  73. * }
  74. *
  75. * @param message
  76. */
  77. router.post(APIv1.Chats.PM, function (req, res) {
  78. // 检查消息体及消息格式是否正确
  79. let message = req.body;
  80. if (!objectUtil.isJsonObject(message)) {
  81. throw {httpStatus: 406, message: 'Problems parsing JSON.'}
  82. }
  83. // 字段判断
  84. let testing = objectUtil.fieldsCheck(message, "from", "to", "contentType", "content");
  85. if (!testing.pass) {
  86. throw {httpStatus: 406, message: testing.message};
  87. }
  88. // 消息处理,患者与医生分开发送
  89. Patient.isPatientCode(message.to,
  90. function () {
  91. let patient = new Patient();
  92. controllerUtil.regModelEventHandler(patient, res);
  93. patient.sendMessage(message);
  94. }, function () {
  95. let doctor = new Doctor();
  96. controllerUtil.regModelEventHandler(doctor, res);
  97. doctor.sendMessage(message);
  98. });
  99. });
  100. /**
  101. * 处理讨论组消息。
  102. *
  103. * 请求URL:
  104. * /chats/gm
  105. *
  106. * 消息格式:
  107. * {
  108. * from: "sand", // 发送者id
  109. * at: "Rose", // @人
  110. * group: "DiscussionGroupId", // 所在组
  111. * groupType: "1 or 2", // 组类型:行政团队或讨论组
  112. * contentType: "1,2,3", // 内容类型
  113. * content: "The patient mess me up" // 内容
  114. * }
  115. *
  116. * @param message
  117. */
  118. router.post(APIv1.Chats.GM, function (req, res) {
  119. // 检查消息体及消息格式是否正确
  120. let message = req.body;
  121. if (!objectUtil.isJsonObject(message)) {
  122. throw {httpStatus: 406, message: 'Problems parsing JSON.'};
  123. }
  124. // 字段判断
  125. let testing = objectUtil.fieldsCheck(message, 'from', 'at', 'group', 'groupType', 'contentType', 'content');
  126. if (!testing.pass) {
  127. throw {httpStatus: 406, message: testing.message}
  128. }
  129. // 消息处理
  130. let group = new Group();
  131. controllerUtil.regModelEventHandler(group, res);
  132. group.sendMessage(message);
  133. });
  134. //--------------------------------------------------------------//
  135. //----------------------------消息提取----------------------------//
  136. //--------------------------------------------------------------//
  137. /**
  138. * 获取参与的聊天列表,包括:点对点,@我,参与的讨论组,系统消息等。
  139. *
  140. * 请求URL:
  141. * /chats/list?user_id=sand
  142. */
  143. router.get(APIv1.Chats.List, function (req, res) {
  144. let userId = req.query.user_id;
  145. if (userId === null) {
  146. throw {httpStatus: 406, message: 'Missing fields.'};
  147. }
  148. let doctor = new Doctor();
  149. controllerUtil.regModelEventHandler(doctor, res);
  150. doctor.getChatList(userId);
  151. });
  152. /**
  153. * 获取与患者的聊天列表,包括:P2P,参与的讨论组和行政团队。
  154. *
  155. * 请求URL:
  156. * /chats/list/patient
  157. */
  158. router.get(APIv1.Chats.ListWithPatient, function (req, res) {
  159. let userId = req.query.user_id;
  160. if (userId === null) {
  161. throw {httpStatus: 406, message: 'Missing fields.'};
  162. }
  163. let doctor = new Doctor();
  164. controllerUtil.regModelEventHandler(doctor, res);
  165. doctor.getChatsListWithPatient(userId);
  166. });
  167. /**
  168. * 获取与医生的聊天列表,包括:点对点,参与的讨论组。
  169. *
  170. * 请求URL:
  171. * /chats/list/doctor
  172. */
  173. router.get(APIv1.Chats.ListWithDoctor, function (req, res) {
  174. let userId = req.query.user_id;
  175. if (userId === null) {
  176. throw {httpStatus: 406, message: 'Missing fields.'};
  177. }
  178. let doctor = new Doctor();
  179. controllerUtil.regModelEventHandler(doctor, res);
  180. doctor.getChatListWithDoctor(userId);
  181. });
  182. router.get(APIv1.Chats.MsgAmount, function (req, res) {
  183. let userId = req.query.user_id;
  184. if (userId === null) {
  185. throw {httpStatus: 406, message: 'Missing fields.'};
  186. }
  187. let doctor = new Doctor();
  188. controllerUtil.regModelEventHandler(doctor, res);
  189. doctor.getChatListMsgAmount(userId);
  190. });
  191. /**
  192. * 获取最近聊天对象:包括患者,医生与讨论组。客户端自行根据需要提取患者、医生或讨论组数据。
  193. *
  194. * 请求URL:
  195. * /chats/recent?user_id=0de7295862dd11e69faffa163e8aee56&days=7
  196. *
  197. * 参数:
  198. * user_id: 用户ID
  199. * target_type: 对象类型,1患者,2医生,3讨论组
  200. * days: 最近天数,默认7天
  201. */
  202. router.get(APIv1.Chats.Recent, function (req, res) {
  203. let userId = req.query.user_id;
  204. let days = req.query.days;
  205. if (userId === null) {
  206. throw {httpStatus: 406, message: 'Missing field: user_id'};
  207. }
  208. if (days === null) {
  209. days = 7;
  210. }
  211. let doctor = new Doctor();
  212. controllerUtil.regModelEventHandler(doctor, res);
  213. doctor.getRecentChatList(userId, days);
  214. });
  215. /**
  216. * 获取私信。倒序排列。
  217. *
  218. * 参数:
  219. * user_id 必须,医生ID
  220. * peer_id 必须,对方医生ID
  221. * content_type 必须,消息类型
  222. * message_start_id 可选,消息的起始ID,如果为空从最新的一条开始获取
  223. * message_end_id 可选,消息的结束ID,如果为空从第一条开始获取
  224. * count 可选,消息数量,如果不指定、小于零或大于50,默认为100条。若message_start_id与message_end_id均不为空,则此参数无效,方法是设置为10000条
  225. * closed_interval 消息范围是否使用闭区间
  226. *
  227. * 请求URL:
  228. * /chats/pm?user_id=sand&peer_id=Rose&content_type=2&message_start_id=10000&message_end_id=0&count=20&closed_interval=false
  229. */
  230. router.get(APIv1.Chats.PM, function (req, res) {
  231. let userId = req.query.user_id;
  232. let peerId = req.query.peer_id;
  233. let contentType = req.query.content_type;
  234. let msgStartId = !req.query.message_start_id ? MAX_INT : parseInt(req.query.message_start_id);
  235. let msgEndId = !req.query.message_end_id || req.query.message_end_id === 'null' ? 0 : parseInt(req.query.message_end_id);
  236. let count = req.query.count === undefined ? DEFAULT_PAGE_SIZE : parseInt(req.query.count);
  237. let closedInterval = (req.query.closed_interval != false && req.query.closed_interval === "true");
  238. if (contentType !== undefined && parseInt(contentType) === CONTENT_TYPES.Image) count = DEFAULT_PAGE_SIZE;
  239. if (req.query.message_start_id && req.query.message_end_id) count = 10000;
  240. if (!userId) {
  241. throw {httpStatus: 400, message: "Missing field: user_id."};
  242. }
  243. let doctor = new Doctor();
  244. controllerUtil.regModelEventHandler(doctor, res);
  245. doctor.getPrivateMessages(userId, peerId, contentType, msgStartId, msgEndId, count, closedInterval);
  246. });
  247. /**
  248. * 获取未读私信。倒序排列。
  249. *
  250. * 参数:
  251. * user_id 必须,医生ID
  252. * peer_id 必须,对方医生ID
  253. *
  254. * 请求URL:
  255. * /chats/pm/unread?user_id=sand&peer_id=Rose
  256. */
  257. router.get(APIv1.Chats.PMUnread, function (req, res) {
  258. let userId = req.query.user_id;
  259. let peerId = req.query.peer_id;
  260. if (userId === undefined) {
  261. throw {httpStatus: 400, message: "Missing field: user_id."};
  262. }
  263. let doctor = new Doctor();
  264. controllerUtil.regModelEventHandler(doctor, res);
  265. doctor.getUnreadPrivateMessages(userId, peerId);
  266. });
  267. /**
  268. * 按时间倒序获取群消息。
  269. *
  270. * 参数:
  271. * user_id 必须,医生ID
  272. * group_id 必须,组ID
  273. * message_start_id 可选,消息的起始ID,如果为空从最新的一条开始获取
  274. * count 可选,消息数量,如果不指定、小于零或大于50,默认为50条
  275. *
  276. * 请求URL:
  277. * /chats/gm?user_id=D2016008240002&group_id=494&content_type=2&message_start_id=0&message_end_id=0&count=20
  278. */
  279. router.get(APIv1.Chats.GM, function (req, res) {
  280. let groupId = req.query.group_id;
  281. let memberId = req.query.user_id;
  282. let contentType = req.query.content_type;
  283. let msgStartId = !req.query.message_start_id ? MAX_INT : parseInt(req.query.message_start_id);
  284. let msgEndId = !req.query.message_end_id ? 0 : parseInt(req.query.message_end_id);
  285. let count = req.query.count === undefined ? DEFAULT_PAGE_SIZE : parseInt(req.query.count);
  286. if (groupId === undefined) {
  287. throw {httpStatus: 400, message: "Missing field: group_id."};
  288. }
  289. if (contentType !== undefined && parseInt(contentType) === CONTENT_TYPES.Image) count = DEFAULT_PAGE_SIZE;
  290. if (req.query.message_start_id && req.query.message_end_id) count = 100000;
  291. let group = new Group();
  292. controllerUtil.regModelEventHandler(group, res);
  293. group.getMessages(groupId, memberId, contentType, msgStartId, msgEndId, count);
  294. });
  295. /**
  296. * 获取未读群消息。
  297. *
  298. * 请求URL:
  299. * /chats/gm/unread?group_id=discussionGroupId&user_id=sand
  300. */
  301. router.get(APIv1.Chats.GMUnread, function (req, res) {
  302. let memberId = req.query.user_id;
  303. let groupId = req.query.group_id;
  304. if (memberId === undefined) {
  305. throw {httpStatus: 400, message: "Missing field: user_id."};
  306. }
  307. if (groupId === undefined) {
  308. throw {httpStatus: 400, message: "Missing field: group_id."};
  309. }
  310. let group = new Group();
  311. controllerUtil.regModelEventHandler(group, res);
  312. group.getUnreadMessages(groupId, memberId);
  313. });
  314. //--------------------------------------------------------------//
  315. //----------------------------消息统计----------------------------//
  316. //--------------------------------------------------------------//
  317. /**
  318. * 获取所有群组未读消息总数。
  319. *
  320. * 请求URL:
  321. * /chats/gm/unread_count?user_id=sand
  322. *
  323. * 参数:
  324. * user_id:医生ID
  325. */
  326. router.get(APIv1.Chats.GMUnreadCount, function (req, res) {
  327. let memberId = req.query.user_id;
  328. if (memberId === null) {
  329. throw {httpStatus: 406, message: 'Missing fields.'};
  330. }
  331. let group = new Group();
  332. controllerUtil.regModelEventHandler(group, res);
  333. group.getUnreadMessageCount(memberId);
  334. });
  335. /**
  336. * 获取特定群组消息统计情况。
  337. *
  338. * /chats/gm/statistic?group_id=GGG&&user_id=sand
  339. *
  340. * 参数:
  341. * user_id:信息所有者id
  342. * group_id:群组id
  343. */
  344. router.get(APIv1.Chats.GMStats, function (req, res) {
  345. let memberId = req.query.user_id;
  346. let groupId = req.query.group_id;
  347. if (memberId === null || groupId === null) {
  348. throw {httpStatus: 406, message: 'Miss fields.'};
  349. }
  350. let group = new Group();
  351. controllerUtil.regModelEventHandler(group, res);
  352. group.getChatSummary(groupId, memberId);
  353. });
  354. /**
  355. * 获取与某人的私信统计。
  356. *
  357. * /chats/pm/statistic?user_id=sand&&peer_id=rose
  358. *
  359. * 参数:
  360. * user_id:信息所有者id
  361. * peer_id:聊天对端id
  362. */
  363. router.get(APIv1.Chats.PMStats, function (req, res) {
  364. let userId = req.query.user_id;
  365. let peerId = req.query.peer_id;
  366. if (userId == null || peerId == null) {
  367. throw {httpStatus: 406, message: "Missing fields."};
  368. }
  369. let doctor = new Doctor();
  370. controllerUtil.regModelEventHandler(doctor, res);
  371. doctor.getChatSummary(userId, peerId);
  372. });
  373. /**
  374. * 获取所有未读私信总数。
  375. *
  376. * /chats/pm/unread_count?user_id=sand
  377. *
  378. * 参数:
  379. * uid:信息所有者id
  380. */
  381. router.get(APIv1.Chats.PMUnreadCount, function (req, res) {
  382. let userId = req.query.user_id;
  383. let doctor = new Doctor();
  384. controllerUtil.regModelEventHandler(doctor, res);
  385. doctor.getUnreadPrivateMessages(userId);
  386. });
  387. /**
  388. * 所有聊天消息未读数。
  389. *
  390. * 请求URL:
  391. * /chats/chats/unread_count?user_id=sand
  392. *
  393. * 参数:
  394. * user_id:信息所有者id
  395. */
  396. router.get(APIv1.Chats.UnreadMsgCount, function (req, res) {
  397. let userId = req.query.user_id;
  398. if (userId === null) {
  399. throw {httpStatus: 406, message: "Missing fields."};
  400. }
  401. let doctor = new Doctor();
  402. controllerUtil.regModelEventHandler(doctor, res);
  403. doctor.getAllUnreadMessageCount(userId);
  404. });
  405. /**
  406. * 搜索患者相关的数据,包括患者信息与相关的私信记录。关键词不支持空格拆分。
  407. *
  408. * 请求URL:
  409. * http://192.168.131.107:3000/api/v1/chats/search/patient?user_id=D2016008240003&user_role=3&keyword=fa
  410. *
  411. * 参数:
  412. * keywords: 关键词
  413. */
  414. router.get(APIv1.Chats.SearchAboutPatient, function (req, res) {
  415. var userId = req.query.user_id;
  416. var userRole = req.query.user_role;
  417. var keyword = req.query.keyword;
  418. if (!userId) throw {httpStatus: 406, message: "Missing fields: user_id."};
  419. if (!userRole) throw {httpStatus: 406, message: "Missing fields: user_role."};
  420. if (!keyword) throw {httpStatus: 406, message: "Missing fields: keyword."};
  421. let search = new Search();
  422. controllerUtil.regModelEventHandler(search, res);
  423. search.searchAboutPatient(userId, userRole, keyword);
  424. });
  425. /**
  426. * 获取某个聊天的关键字搜索记录列表
  427. * 请求URL:
  428. *http://192.168.131.107:3000/api/v1/chats/search/patient/list?user_id=D2016008240003&keyword=f&group_id=e2b695b9daf74d0faeb90a304ae587a0&type=1
  429. */
  430. router.get(APIv1.Chats.SearchAboutPatientList, function (req, res) {
  431. var userId = req.query.user_id;
  432. var groupId = req.query.group_id;
  433. var keyword = req.query.keyword;
  434. var type = req.query.type;
  435. if (!userId) throw {httpStatus: 406, message: "Missing fields: user_id."};
  436. if (!groupId) throw {httpStatus: 406, message: "Missing fields: group_id."};
  437. if (!keyword) throw {httpStatus: 406, message: "Missing fields: keyword."};
  438. if (!type) throw {httpStatus: 406, message: "Missing fields: type."};
  439. let search = new Search();
  440. controllerUtil.regModelEventHandler(search, res);
  441. search.searchAboutPatientList(userId, keyword,groupId,type);
  442. });
  443. /**
  444. * http://192.168.131.107:3000/api/v1/chats/search/patient/all?user_id=D2016008240003&keyword=f&type=2&user_role=3
  445. * 患者消息查询查看更多
  446. */
  447. router.get(APIv1.Chats.SearchAbountPatientMore, function (req, res) {
  448. var userId = req.query.user_id;
  449. var keyword = req.query.keyword;
  450. var type = req.query.type;
  451. var userRole= req.query.user_role;
  452. if (!userId) throw {httpStatus: 406, message: "Missing fields: user_id."};
  453. if (!keyword) throw {httpStatus: 406, message: "Missing fields: keyword."};
  454. if (!type) throw {httpStatus: 406, message: "Missing fields: type."};
  455. if (!userRole) throw {httpStatus: 406, message: "Missing fields: userRole."};
  456. let search = new Search();
  457. controllerUtil.regModelEventHandler(search, res);
  458. search.searchAboutPatientAll(userId,userRole, keyword,type);
  459. });
  460. /**
  461. * 搜索医生相关的数据,包括医生信息与相关的聊天记录,包括私信与群信。
  462. *
  463. * 请求URL:
  464. * /search/doctor?user_id=D2016008240003&keyword=黄
  465. *
  466. * 参数:
  467. * keywords: 关键词
  468. */
  469. router.get(APIv1.Chats.SearchAboutDoctor, function (req, res) {
  470. let userId = req.query.user_id;
  471. let keyword = req.query.keyword;
  472. if (!userId) throw {httpStatus: 406, message: "Missing fields: user_id."};
  473. if (!keyword) throw {httpStatus: 406, message: "Missing fields: keyword."};
  474. let search = new Search();
  475. controllerUtil.regModelEventHandler(search, res);
  476. search.searchAboutDoctor(userId, keyword);
  477. });
  478. /**
  479. * http://192.168.131.107:3000/api/v1/chats/search/doctor/list?user_id=D2016008240003&keyword=%E9%BB%84&type=2
  480. * 医生搜索查看更多
  481. * type = 1 查询聊过的医生
  482. * type = 2 查询群组标题和人员包含的群聊
  483. * type = 3 查询聊天关键字
  484. */
  485. router.get(APIv1.Chats.SearchAboutDoctorList, function (req, res) {
  486. let userId = req.query.user_id;
  487. let keyword = req.query.keyword;
  488. let type = req.query.type;
  489. if (!userId) throw {httpStatus: 406, message: "Missing fields: user_id."};
  490. if (!keyword) throw {httpStatus: 406, message: "Missing fields: keyword."};
  491. if (!type) throw {httpStatus: 406, message: "Missing fields: type."};
  492. let search = new Search();
  493. controllerUtil.regModelEventHandler(search, res);
  494. search.searchDoctorMore(userId, keyword,type);
  495. });
  496. /**
  497. * 查询医生聊天记录详情(单个聊天记录包含关键字的)
  498. *http://192.168.131.107:3000/api/v1/chats/search/doctor/content/list?user_id=D2016008240003&keyword=f&type=2&groupcode=0381288df51b434795b6946bb63d90b8
  499. */
  500. router.get(APIv1.Chats.SearchAbountDoctorContentDetail, function (req, res) {
  501. let userId = req.query.user_id;
  502. let keyword = req.query.keyword;
  503. let type = req.query.type;
  504. let groupcode = req.query.groupcode;
  505. if (!userId) throw {httpStatus: 406, message: "Missing fields: user_id."};
  506. if (!keyword) throw {httpStatus: 406, message: "Missing fields: keyword."};
  507. if (!type) throw {httpStatus: 406, message: "Missing fields: type."};
  508. if (!groupcode) throw {httpStatus: 406, message: "Missing fields: groupcode."};
  509. let search = new Search();
  510. controllerUtil.regModelEventHandler(search, res);
  511. search.searchDoctorContentDetail(userId, keyword,groupcode,type);
  512. });
  513. /**
  514. * 获取单条消息。
  515. *
  516. * URL:
  517. * /chats/message?id=1234&type=1
  518. */
  519. router.get(APIv1.Chats.Message, function (req, res) {
  520. let messageId = req.query.id;
  521. let messageType = req.query.type;
  522. let doctor = new Doctor();
  523. controllerUtil.regModelEventHandler(doctor, res);
  524. doctor.getMessage(messageId, messageType);
  525. });
  526. /**
  527. * 判断当前会话是否已经结束。
  528. *
  529. * 请求URL:
  530. * /chats/pm/finished?user_id=sand&peer_id=rose
  531. */
  532. router.get(APIv1.Chats.PMFinished, function (req, res) {
  533. let doctorId = req.query.doctor_id;
  534. let patientId = req.query.patient_id;
  535. if (!doctorId) {
  536. throw {httpStatus: 406, message: "Missing field: doctor_id"};
  537. }
  538. if (!patientId) {
  539. throw {httpStatus: 406, message: "Missing field: patient_id"};
  540. }
  541. let doctor = new Doctor();
  542. controllerUtil.regModelEventHandler(doctor, res);
  543. doctor.isConsultFinished(doctorId, patientId);
  544. });
  545. module.exports = router;