فهرست منبع

续方咨询修改

yeshijie 8 سال پیش
والد
کامیت
34c950c010

+ 14 - 0
src/server/endpoints/v2/topic.endpoint.js

@ -67,6 +67,20 @@ router.get(APIv2.Sessions.HealthTopicList, function (req, res) {
    topic.findAllByUserAndReplyAndStatusHealthTopic(users,reply,status,page,pagesize);
});
router.get(APIv2.Sessions.TopicListByType,function (req,res) {
    let user = req.query.user;
    let status = req.query.status;
    let type = req.query.type;
    let reply = req.query.reply;//SESSION_TYPES
    let page = req.query.page;
    let pagesize = req.query.pagesize;
    let topic = new Topics();
    ControllerUtil.regModelEventHandler(topic, res);
    let users = user.split(",");
    topic.findAllTopicByType(users,reply,status,type,page,pagesize);
});
router.get(APIv2.Sessions.HealthTeamTopicList, function (req, res) {
    let user = req.query.user;
    let status = req.query.status;

+ 1 - 0
src/server/include/endpoints.js

@ -37,6 +37,7 @@ const APIv2 = {
        TopicInto: '/:session_id/topics/:topic_id/into',              // 居民进入议题
        TopicList:'/topics',
        HealthTopicList:'/healthTopics', //健康咨询
        TopicListByType:'/topicListByType', //按类型查找咨询(未回复,进行中,已回复)
        HealthTeamTopicList:'/healthTeamTopics', //健康咨询(区分团队)
        TopicReplyCount:"/topics/count/reply",
        TopicMessages:'/topic/:topic_id/messages',

+ 22 - 0
src/server/models/sessions/topics.js

@ -162,6 +162,28 @@ class Topics extends RedisModel {
        })
    }
    /**
     * 按类型查找医生的未回复,进行中,已完成的咨询
     * @param users
     * @param reply
     * @param status
     * @param adminTeamCode
     * @param page
     * @param pagesize
     */
    findAllTopicByType(users,reply, status,type, 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) {
            if (err) {
                ModelUtil.emitError(self.eventEmitter, "获取列表失败" + err);
            }
            ModelUtil.emitOK(self.eventEmitter, res);
        })
    }
    findReplyCount(users,reply, status,adminTeamCode) {
        let self = this;

+ 41 - 6
src/server/repository/mysql/topics.repo.js

@ -84,7 +84,7 @@ class TopicRepo {
    }
    /**
     * 过滤名医咨询
     * 过滤名医咨询和续方咨询
     * @param userId
     * @param reply
     * @param status
@ -100,13 +100,13 @@ class TopicRepo {
            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 !='6' ORDER BY create_time DESC limit ?,?";
                "AND d.id in (?) AND t. STATUS = ? AND c.type not in ('6','8') ORDER BY create_time DESC limit ?,?";
        }else{
            args.push(userId,status,reply,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 !='6' ORDER BY create_time DESC limit ?,?";
                "AND d.id in (?) AND t. STATUS = ? and t.reply=? AND c.type not in ('6','8') ORDER BY create_time DESC limit ?,?";
        }
        ImDb.execQuery({
            sql: sql,
@ -118,7 +118,42 @@ class TopicRepo {
    }
    /**
     * 过滤名医咨询(区分团队)
     * 按类型查找医生的未回复,进行中,已完成的咨询
     * @param userId
     * @param reply
     * @param status
     * @param type
     * @param page
     * @param size
     * @param handler
     */
    static findAllTopicByType(userId,reply,status,type,page,size,handler){
        let sql = "";
        var args =[];
        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 ?,?";
        }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 not in ? ORDER BY create_time DESC limit ?,?";
        }
        ImDb.execQuery({
            sql: sql,
            args: args,
            handler: function (err, res) {
                handler(err, res);
            }
        });
    }
    /**
     * 过滤名医咨询和续方咨询(区分团队)
     * @param userId
     * @param reply
     * @param status
@ -134,13 +169,13 @@ class TopicRepo {
            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.WlyyConsultTeam+" c,"+DB_TABLES.Patients+" s "+
                "WHERE d.id = p.participant_id AND c.consult = t.id AND c.patient = s.id AND p.session_id = t.session_id "+
                "AND c.admin_team_code =? AND d.id in (?) AND t. STATUS = ? AND c.type !='6' ORDER BY create_time DESC limit ?,?";
                "AND c.admin_team_code =? AND d.id in (?) AND t. STATUS = ? AND c.type not in ('6','8') ORDER BY create_time DESC limit ?,?";
        }else{
            args.push(adminTeamCode,userId,status,reply,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.WlyyConsultTeam+" c,"+DB_TABLES.Patients+" s "+
                "WHERE d.id = p.participant_id AND c.consult = t.id AND c.patient = s.id AND p.session_id = t.session_id "+
                "AND c.admin_team_code =? AND d.id in (?) AND t. STATUS = ? and t.reply=? AND c.type !='6' ORDER BY create_time DESC limit ?,?";
                "AND c.admin_team_code =? AND d.id in (?) AND t. STATUS = ? and t.reply=? AND c.type not in ('6','8') ORDER BY create_time DESC limit ?,?";
        }
        ImDb.execQuery({
            sql: sql,