浏览代码

续方咨询修改

yeshijie 7 年之前
父节点
当前提交
c9992912ca

+ 4 - 1
src/server/endpoints/v2/topic.endpoint.js

@ -74,10 +74,13 @@ router.get(APIv2.Sessions.TopicListByType,function (req,res) {
    let reply = req.query.reply;//SESSION_TYPES
    let page = req.query.page;
    let pagesize = req.query.pagesize;
    let patientName = req.query.patientName;
    let startTime = req.query.startTime;
    let endTime = req.query.endTime;
    let topic = new Topics();
    ControllerUtil.regModelEventHandler(topic, res);
    let users = user.split(",");
    topic.findAllTopicByType(users,reply,status,type,page,pagesize);
    topic.findAllTopicByType(users,reply,status,type,patientName,startTime,endTime,page,pagesize);
});

+ 2 - 2
src/server/models/sessions/topics.js

@ -171,12 +171,12 @@ class Topics extends RedisModel {
     * @param page
     * @param pagesize
     */
    findAllTopicByType(users,reply, status,type, page, pagesize) {
    findAllTopicByType(users,reply, status,type,patientName,startTime,endTime, page, pagesize) {
        let self = this;
        page = (page - 1 < 0 ? 0 : page - 1) * pagesize;
        if (!pagesize) pagesize = 10;
        pagesize = parseInt(pagesize);
        TopicsRepo.findAllTopicByType(users,reply,status,type, page, pagesize, function (err, res) {
        TopicsRepo.findAllTopicByType(users,reply,status,type,patientName,startTime,endTime, page, pagesize, function (err, res) {
            if (err) {
                ModelUtil.emitError(self.eventEmitter, "获取列表失败" + err);
            }

+ 13 - 3
src/server/repository/mysql/topics.repo.js

@ -127,21 +127,31 @@ class TopicRepo {
     * @param size
     * @param handler
     */
    static findAllTopicByType(userId,reply,status,type,page,size,handler){
    static findAllTopicByType(userId,reply,status,type,patientName,startTime,endTime,page,size,handler){
        let sql = "";
        var args =[];
        var tempParms = "";
        if(patientName){
            tempParms += " and s.name like '%"+patientName+"%' ";
        }
        if(startTime){
            tempParms += " and t.create_time >= '"+startTime+"' ";
        }
        if(endTime){
            tempParms += " and t.create_time <= '"+endTime+"' ";
        }
        if(status==10){
            args.push(userId,status,type,page,size);
            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 =? ORDER BY create_time DESC limit ?,?";
                "AND d.id in (?) AND t. STATUS = ? AND c.type =? "+tempParms+" ORDER BY create_time DESC limit ?,?";
        }else{
            args.push(userId,status,reply,type,page,size);
            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 = ? ORDER BY create_time DESC limit ?,?";
                "AND d.id in (?) AND t. STATUS = ? and t.reply=? AND c.type = ? "+tempParms+" ORDER BY create_time DESC limit ?,?";
        }
        ImDb.execQuery({
            sql: sql,