Skip to content

调查问卷

获取调查问卷详情

GET /plugins/survey/survey/{surveyId}

响应

json
{
    "survey": {
        "id": "3",
        "type": "offlineCourseQuestionnaire",
        "title": "大学生体质调查",
        "description": "大学生体质情况调查",
        "isResultVisible": "0",
        "isAnonymous": "0",
        "startTime": "1514995200",
        "endTime": "1515686399",
        "allCount": 10,
        "finishedCount": 3
    },
    "questionnaireItems": [
        {
            "id": "38",
            "type": "singleChoice",
            "stem": "您的性别",
            "metas": [
                {
                    "name": "男",
                    "order": 0
                },
                {
                    "name": "女",
                    "order": 1
                }
            ],
            "seq": "0",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "39",
            "type": "singleChoice",
            "stem": "一星期进行几次锻炼",
            "metas": [
                {
                    "name": "1天一次",
                    "order": 0
                },
                {
                    "name": "2天一次",
                    "order": 1
                },
                {
                    "name": "3天一次",
                    "order": 2
                },
                {
                    "name": "偶尔",
                    "order": 3
                }
            ],
            "seq": "1",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "40",
            "type": "multipleChoice",
            "stem": "请问您对体测过程中代测的情况怎么看(可多选)",
            "metas": [
                {
                    "name": "情有可原",
                    "order": 0
                },
                {
                    "name": "没感觉",
                    "order": 1
                },
                {
                    "name": "是一种欺骗行为",
                    "order": 2
                },
                {
                    "name": "对其他同学不公平",
                    "order": 3
                }
            ],
            "seq": "2",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "41",
            "type": "blankFillingQuestion",
            "stem": "您对大学体育锻炼有什么建议",
            "metas": [],
            "seq": "3",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        }
    ]
}

问卷调查对象(survey)

字段描述
type类型(questionnaire:需求问卷;offlineCourseQuestionnaire:线下课程评价问卷;course:课程里的评价问卷)
title标题
description描述
isResultVisible结果是否可看
isAnonymous是否匿名
startTime问卷开始时间(为空时不显示)
endTime问卷结束时间(为空时不显示)
allCount调查推送人数
finishedCount问卷回收份数

问卷题目对象(questionnaireItems)

字段描述
id题目id
type题目类型(singleChoice:单选,multipleChoice:多选,blankFillingQuestion:问答题)
stem题干
metas选择题的选项
seq序号
isOptional是否选填(0:必填,1:选填)

做调查问卷

POST  /plugins/survey/me/survey_results

权限

  • 需要认证

参数

字段描述
surveyId调查问卷id

响应

json
{
    "survey": {
        "title": "大学生体质调查",
        "description": "大学生体质情况调查",
        "isResultVisible": "0",
        "isAnonymous": "0"
    },
    "surveyResult": {
        "id": "2",
        "status": "doing"
    },
    "questionnaireItems": [
        {
            "id": "38",
            "type": "singleChoice",
            "stem": "您的性别",
            "metas": [
                {
                    "name": "男",
                    "order": 0
                },
                {
                    "name": "女",
                    "order": 1
                }
            ],
            "seq": "0",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "39",
            "type": "singleChoice",
            "stem": "一星期进行几次锻炼",
            "metas": [
                {
                    "name": "1天一次",
                    "order": 0
                },
                {
                    "name": "2天一次",
                    "order": 1
                },
                {
                    "name": "3天一次",
                    "order": 2
                },
                {
                    "name": "偶尔",
                    "order": 3
                }
            ],
            "seq": "1",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "40",
            "type": "multipleChoice",
            "stem": "请问您对体测过程中代测的情况怎么看(可多选)",
            "metas": [
                {
                    "name": "情有可原",
                    "order": 0
                },
                {
                    "name": "没感觉",
                    "order": 1
                },
                {
                    "name": "是一种欺骗行为",
                    "order": 2
                },
                {
                    "name": "对其他同学不公平",
                    "order": 3
                }
            ],
            "seq": "2",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "41",
            "type": "blankFillingQuestion",
            "stem": "您对大学体育锻炼有什么建议",
            "metas": [],
            "seq": "3",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        }
    ]
}

问卷调查对象(survey)

字段描述
title标题
description描述
isResultVisible结果是否可看
isAnonymous是否匿名

调查结果对象(surveyResult)

字段描述
id问卷调查结果id
status问卷调查结果状态(doing:没做状态,finished:已完成)

问卷题目对象(questionnaireItems)

字段描述
id题目id
type题目类型(singleChoice:单选,multipleChoice:多选,blankFillingQuestion:问答题)
stem题干
metas选择题的选项
seq序号
isOptional是否选填(0:必填,1:选填)

提交调查问卷

PATCH /plugins/survey/me/survey_results/{surveyResultId}

权限

  • 需要认证

参数

字段描述
surveyResultId问卷调查结果id

请求实例

json
{
    "answers": [
    	{
            "questionnaireItemId": "41", 
            "answer": "不知道"
        },
        {
            "questionnaireItemId": "38", 
            "answer": "0"
        }, 
        {
            "questionnaireItemId": "39", 
            "answer": "1"
        }, 
        {
            "questionnaireItemId": "40", 
            "answer": "1,2"
        }
       
    ]
}

响应

字段描述
submittedtrue:提交成功,false:提交失败

查看调查问卷统计结果

GET /plugins/survey/survey_result_statistics/{surveyId}
json
{
    "survey": {
        "title": "大学生体质调查",
        "description": "大学生体质情况调查",
        "isResultVisible": "1",
        "isAnonymous": "0",
        "startTime": "1516118400",
        "endTime": "1516463999",
        "allCount": 2,
        "finishedCount": 2
    },
    "questionnaireItems": [
        {
            "id": "38",
            "type": "singleChoice",
            "stem": "您的性别",
            "metas": [
                {
                    "name": "男",
                    "order": 0,
                    "statistics": {
                        "count": 2,
                        "percent": 100,
                        "order": 0
                    }
                },
                {
                    "name": "女",
                    "order": 1,
                    "statistics": {
                        "count": 0,
                        "percent": 0,
                        "order": 1
                    }
                }
            ],
            "seq": "0",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "39",
            "type": "singleChoice",
            "stem": "一星期进行几次锻炼",
            "metas": [
                {
                    "name": "1天一次",
                    "order": 0,
                    "statistics": {
                        "count": 0,
                        "percent": 0,
                        "order": 0
                    }
                },
                {
                    "name": "2天一次",
                    "order": 1,
                    "statistics": {
                        "count": 2,
                        "percent": 100,
                        "order": 1
                    }
                },
                {
                    "name": "3天一次",
                    "order": 2,
                    "statistics": {
                        "count": 0,
                        "percent": 0,
                        "order": 2
                    }
                },
                {
                    "name": "偶尔",
                    "order": 3,
                    "statistics": {
                        "count": 0,
                        "percent": 0,
                        "order": 3
                    }
                }
            ],
            "seq": "1",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "40",
            "type": "multipleChoice",
            "stem": "请问您对体测过程中代测的情况怎么看(可多选)",
            "metas": [
                {
                    "name": "情有可原",
                    "order": 0,
                    "statistics": {
                        "count": 0,
                        "percent": 0,
                        "order": 0
                    }
                },
                {
                    "name": "没感觉",
                    "order": 1,
                    "statistics": {
                        "count": 1,
                        "percent": 50,
                        "order": 1
                    }
                },
                {
                    "name": "是一种欺骗行为",
                    "order": 2,
                    "statistics": {
                        "count": 0,
                        "percent": 0,
                        "order": 2
                    }
                },
                {
                    "name": "对其他同学不公平",
                    "order": 3,
                    "statistics": {
                        "count": 0,
                        "percent": 0,
                        "order": 3
                    }
                }
            ],
            "seq": "2",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293"
        },
        {
            "id": "41",
            "type": "blankFillingQuestion",
            "stem": "您对大学体育锻炼有什么建议",
            "metas": [],
            "seq": "3",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1516170293",
            "updatedTime": "1516170293",
            "statistics": [
                [
                    "dad"
                ],
                [
                    "不知道"
                ]
            ]
        }
    ]
}

响应

statistics对象

字段描述
count总数
percent百分比
option选项序号

查看调查问卷问题统计

GET /plugins/survey/questionnaire_item_answers

参数

字段是否必填描述
questionnaireItemId必填题目id
surveyId必填调查id

响应

json
{
    "data": [
        {
            "surveyId": "3",
            "answer": [
                "不知道"
            ]
        },
        {
            "surveyId": "3",
            "answer": [
                "无话可说"
            ]
        }
    ],
    "paging": {
        "total": 2,
        "offset": 0,
        "limit": 10
    }
}

评价问卷

获取评价问卷

参数

字段描述来自于
surveyId调查idtask.activity.mediaId

surveyId = task.activity.mediaId

GET /plugins/survey/survey/{surveyId}

响应

json
{
    "survey": {
        "title": "评价问卷",
        "description": "啊哈哈哈",
        "isResultVisible": "0",
        "isAnonymous": "0"
    },
    "questionnaireItems": [
        {
            "id": "40",
            "type": "evaluationQuestion",
            "stem": "评价卡",
            "metas": [
                {
                    "name": "评价项1",
                    "weight": "1"
                },
                {
                    "name": "评价项2",
                    "weight": "1"
                }
            ],
            "seq": "0",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1515117548",
            "updatedTime": "1515117548"
        },
        {
            "id": "41",
            "type": "evaluationQuestion",
            "stem": "评价卡",
            "metas": [
                {
                    "name": "评价项1",
                    "weight": "1"
                },
                {
                    "name": "评价项2",
                    "weight": "1"
                }
            ],
            "seq": "1",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1515117548",
            "updatedTime": "1515117548"
        },
        {
            "id": "42",
            "type": "evaluationQuestion",
            "stem": "评价卡",
            "metas": [
                {
                    "name": "评价项1",
                    "weight": "1"
                },
                {
                    "name": "评价项2",
                    "weight": "1"
                }
            ],
            "seq": "2",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1515117548",
            "updatedTime": "1515117548"
        },
        {
            "id": "43",
            "type": "blankFillingQuestion",
            "stem": "问答题",
            "metas": [],
            "seq": "3",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1515117548",
            "updatedTime": "1515117548"
        },
        {
            "id": "44",
            "type": "evaluationQuestion",
            "stem": "评价卡",
            "metas": [
                {
                    "name": "评价项1",
                    "weight": "1"
                },
                {
                    "name": "评价项2",
                    "weight": "1"
                }
            ],
            "seq": "4",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1515117548",
            "updatedTime": "1515117548"
        },
        {
            "id": "45",
            "type": "blankFillingQuestion",
            "stem": "问答题",
            "metas": [],
            "seq": "5",
            "questionnaireId": "2",
            "parentId": "0",
            "isOptional": "0",
            "score": "0.0",
            "createdUserId": "2",
            "createdTime": "1515117548",
            "updatedTime": "1515117548"
        }
    ]
}

评价问卷调查对象(survey)

字段描述
title标题
description描述
isResultVisible不用
isAnonymous不用

评价问卷题目对象(questionnaireItems)

字段描述
id题目id
type题目类型(evaluationQuestion:评价卡,blankFillingQuestion:问答题)
stem题干
metas评价卡的内容,name:名称,weight:权重

做评价问卷(和做调查评卷一样)

POST  /plugins/survey/me/survey_results

权限

  • 需要认证

参数

字段描述
surveyId调查问卷id

响应(和做调查评卷一样)

提交评价问卷(和提交调查一样的接口)

注意:请求实例稍微不同(第一个数字表示第一个评价项的得分,以此类推)

PATCH /plugins/survey/me/survey_reuslts/{surveyResultId}

权限

  • 需要认证

参数

字段描述
surveyResultId问卷调查结果id

请求实例

json
{
    "answers": [
    	{
            "questionnaireItemId": "40", 
            "answer": ["1","1"]
        },
        {
            "questionnaireItemId": "41", 
            "answer": ["1","1"]
        },
        {
            "questionnaireItemId": "42", 
            "answer": ["1","1"]
        },
        {
            "questionnaireItemId": "43", 
            "answer": ["问答题答案1"]
        },
        {
            "questionnaireItemId": "44",
            "answer": ["2","3"]
        },
        {
            "questionnaireItemId": "45", 
            "answer": ["问答题答案2"]
        }
    ]
}