Bläddra i källkod

续方咨询修改

yeshijie 7 år sedan
förälder
incheckning
0d17dc396b

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

@ -84,6 +84,21 @@ router.get(APIv2.Sessions.TopicListByType,function (req,res) {
});
router.get(APIv2.Sessions.topicListCountByType,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 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.topicListCountByType(users,reply,status,type,patientName,startTime,endTime);
});
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

@ -38,6 +38,7 @@ const APIv2 = {
        TopicList:'/topics',
        HealthTopicList:'/healthTopics', //健康咨询
        TopicListByType:'/topicListByType', //按类型查找咨询(未回复,进行中,已回复)
        topicListCountByType:'/topicListCountByType', //按类型查找咨询(未回复,进行中,已回复)的数量
        HealthTeamTopicList:'/healthTeamTopics', //健康咨询(区分团队)
        TopicReplyCount:"/topics/count/reply",
        TopicMessages:'/topic/:topic_id/messages',

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

@ -184,6 +184,23 @@ class Topics extends RedisModel {
        })
    }
    /**
     * 按类型查找医生的未回复,进行中,已完成的咨询 总数
     * @param users
     * @param reply
     * @param status
     * @param adminTeamCode
     */
    topicListCountByType(users,reply, status,type,patientName,startTime,endTime) {
        let self = this;
        TopicsRepo.topicListCountByType(users,reply,status,type,patientName,startTime,endTime, function (err, res) {
            if (err) {
                ModelUtil.emitError(self.eventEmitter, "获取总数失败" + err);
            }
            ModelUtil.emitOK(self.eventEmitter, {count:res[0].count});
        })
    }
    findReplyCount(users,reply, status,adminTeamCode) {
        let self = this;

+ 43 - 0
src/server/repository/mysql/topics.repo.js

@ -162,6 +162,49 @@ class TopicRepo {
        });
    }
    /**
     * 按类型查找医生的未回复,进行中,已完成的咨询 总数
     * @param userId
     * @param reply
     * @param status
     * @param type
     * @param handler
     */
    static topicListCountByType(userId,reply,status,type,patientName,startTime,endTime,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);
            sql =  "SELECT count(t.id) count 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 =? "+tempParms;
        }else{
            args.push(userId,status,reply,type);
            sql =  "SELECT count(t.id) count 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 = ? "+tempParms;
        }
        ImDb.execQuery({
            sql: sql,
            args: args,
            handler: function (err, res) {
                handler(err, res);
            }
        });
    }
    /**
     * 过滤名医咨询和续方咨询(区分团队)
     * @param userId