|
@@ -12,6 +12,7 @@ class RoomService extends CrudService {
|
|
|
this.model = this.ctx.model.Room;
|
|
|
this.pmodel = this.ctx.model.Patient;
|
|
|
this.chatModel = this.ctx.model.Chat;
|
|
|
+ this.remark = this.ctx.model.Remark;
|
|
|
}
|
|
|
|
|
|
async query(data) {
|
|
@@ -22,6 +23,7 @@ class RoomService extends CrudService {
|
|
|
}
|
|
|
if (doctorid) {
|
|
|
const res_ = await this.model.find({ doctorid });
|
|
|
+ const remarks = await this.remark.find({ remarkid: doctorid });
|
|
|
const data = [];
|
|
|
for (const elm of res_) {
|
|
|
const patient = await this.pmodel.findById(elm.patientid);
|
|
@@ -39,7 +41,10 @@ class RoomService extends CrudService {
|
|
|
content = chats[0].content;
|
|
|
sendtime = chats[0].sendtime;
|
|
|
}
|
|
|
- const newdata = { patientid: elm.patientid, patientname: elm.patientname, icon, contenttype, content, sendtime, doctorid: elm.doctorid, doctorname: elm.doctorname };
|
|
|
+ let { patientid, patientname } = elm;
|
|
|
+ const s_r = remarks.find(f => ObjectId(f.benoteid).equals(patientid));
|
|
|
+ if (s_r) patientname = s_r.name;
|
|
|
+ const newdata = { patientid: elm.patientid, patientname, icon, contenttype, content, sendtime, doctorid: elm.doctorid, doctorname: elm.doctorname };
|
|
|
data.push(newdata);
|
|
|
}
|
|
|
res = data;
|