|
@ -92,21 +92,27 @@ class TopicRepo {
|
|
|
* @param size
|
|
|
* @param handler
|
|
|
*/
|
|
|
static findAllByUserAndReplyAndStatusHealthTopic(userId,reply,status,page,size,handler){
|
|
|
static findAllByUserAndReplyAndStatusHealthTopic(userId,reply,status,page,size,handler,patientName){
|
|
|
let sql = "";
|
|
|
var args =[];
|
|
|
var tempParms = "";
|
|
|
|
|
|
if (patientName){
|
|
|
tempParms += " and s.name like '%"+patientName+"%' ";
|
|
|
}
|
|
|
|
|
|
if(status==10){
|
|
|
args.push(userId,status,page,size);
|
|
|
args.push(userId,status,page,size,patientName);
|
|
|
sql = "SELECT t.*, s.avatar,s.sex,s.birthdate, s.`name` AS patient_name,c.doctor FROM "+
|
|
|
DB_TABLES.Topics+" t,"+DB_TABLES.Participants+" p,"+DB_TABLES.Doctors+" d,"+DB_TABLES.WlyyConsult+" c,"+DB_TABLES.Patients+" s "+
|
|
|
"WHERE d.id = p.participant_id AND c.id = t.id AND c.patient = s.id AND p.session_id = t.session_id "+
|
|
|
"AND d.id in (?) AND t. STATUS = ? AND c.type not in ('6','8') ORDER BY create_time DESC limit ?,?";
|
|
|
"AND d.id in (?) AND t. STATUS = ? AND c.type not in ('6','8')"+tempParms+" ORDER BY create_time DESC limit ?,?";
|
|
|
}else{
|
|
|
args.push(userId,status,reply,page,size);
|
|
|
args.push(userId,status,reply,page,size,patientName);
|
|
|
sql = "SELECT t.*, s.avatar,s.sex,s.birthdate, s.`name` AS patient_name,c.doctor FROM "+
|
|
|
DB_TABLES.Topics+" t,"+DB_TABLES.Participants+" p,"+DB_TABLES.Doctors+" d,"+DB_TABLES.WlyyConsult+" c,"+DB_TABLES.Patients+" s "+
|
|
|
"WHERE d.id = p.participant_id AND c.id = t.id AND c.patient = s.id AND p.session_id = t.session_id "+
|
|
|
"AND d.id in (?) AND t. STATUS = ? and t.reply=? AND c.type not in ('6','8') ORDER BY create_time DESC limit ?,?";
|
|
|
"AND d.id in (?) AND t. STATUS = ? and t.reply=? AND c.type not in ('6','8')"+tempParms+" ORDER BY create_time DESC limit ?,?";
|
|
|
}
|
|
|
ImDb.execQuery({
|
|
|
sql: sql,
|