Forráskód Böngészése

集美客服问卷接口修改

humingfen 6 éve
szülő
commit
2bbfc4bbff

+ 165 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionnaire.java

@ -0,0 +1,165 @@
package com.yihu.wlyy.entity.survey;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by Reece on 2017/3/10.
 */
@Entity
@Table(name = "wlyy_survey_questionnaire")
public class SurveyQuestionnaire extends IdEntity implements Serializable {
    //    问题编码
    private String code;
    //            问题标题
    private String title;
    //    问题说明(可为null)
    private String questionComment;
    //    问题类型(0单选 1多选 2问答)
    private int questionType;
    //    关联编码(按使用类型分类)
    private String surveyCode;
    //    是否必答(0否 1是)
    private int isRequired;
    //    最小答案个数(多选有效)
    private Integer minNum;
    //    最大答案个数(多选有效)
    private Integer maxNum;
    //            排序
    private int sort;
    //    下一题问题编码(问答题逻辑跳转)
    private String questionCodeNext;
    //    删除标志(1正常,0删除)
    private int del;
    //    创建时间
    private Date createTime;
    //    修改时间
    private Date updateTime;
    public SurveyQuestionnaire() {
    }
    public SurveyQuestionnaire(String code, String title, String questionComment, int questionType, String surveyCode, int isRequired, Integer minNum, Integer maxNum, int sort, String questionCodeNext, int del, Date createTime, Date updateTime) {
        this.code = code;
        this.title = title;
        this.questionComment = questionComment;
        this.questionType = questionType;
        this.surveyCode = surveyCode;
        this.isRequired = isRequired;
        this.minNum = minNum;
        this.maxNum = maxNum;
        this.sort = sort;
        this.questionCodeNext = questionCodeNext;
        this.del = del;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getQuestionComment() {
        return questionComment;
    }
    public void setQuestionComment(String questionComment) {
        this.questionComment = questionComment;
    }
    public int getQuestionType() {
        return questionType;
    }
    public void setQuestionType(int questionType) {
        this.questionType = questionType;
    }
    public String getSurveyCode() {
        return surveyCode;
    }
    public void setSurveyCode(String surveyCode) {
        this.surveyCode = surveyCode;
    }
    public int getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(int isRequired) {
        this.isRequired = isRequired;
    }
    public Integer getMinNum() {
        return minNum;
    }
    public void setMinNum(Integer minNum) {
        this.minNum = minNum;
    }
    public Integer getMaxNum() {
        return maxNum;
    }
    public void setMaxNum(Integer maxNum) {
        this.maxNum = maxNum;
    }
    public int getSort() {
        return sort;
    }
    public void setSort(int sort) {
        this.sort = sort;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
}

+ 120 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyQuestionnaireOptions.java

@ -0,0 +1,120 @@
package com.yihu.wlyy.entity.survey;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Reece on 2017/3/10.
 */
@Entity
@Table(name = "wlyy_survey_questionnaire_options")
public class SurveyQuestionnaireOptions extends IdEntity implements Serializable {
    //选项编码
    private String code;
    //    是否有选项说明(0没有 1有)
    private int haveComment;
    //    	所属问题编码
    private String questionnaireCode;
    //    选项内容
    private String content;
    //        问卷编码
    private String surveyCode;
    //    下一题问题编码(逻辑跳转)
    private String questionCodeNext;
    //    选项说明是否必填(0否 1是)
    private int isRequired;
    //    单题内排序
    private int sort;
    //    删除标志(1正常,0删除)
    private int del;
    public SurveyQuestionnaireOptions() {
    }
    public SurveyQuestionnaireOptions(String code, int haveComment, String questionnaireCode, String content, String surveyCode, String questionCodeNext, int isRequired, int sort, int del) {
        this.code = code;
        this.haveComment = haveComment;
        this.questionnaireCode = questionnaireCode;
        this.content = content;
        this.surveyCode = surveyCode;
        this.questionCodeNext = questionCodeNext;
        this.isRequired = isRequired;
        this.sort = sort;
        this.del = del;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public int getHaveComment() {
        return haveComment;
    }
    public void setHaveComment(int haveComment) {
        this.haveComment = haveComment;
    }
    public String getQuestionnaireCode() {
        return questionnaireCode;
    }
    public void setQuestionnaireCode(String questionnaireCode) {
        this.questionnaireCode = questionnaireCode;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getSurveyCode() {
        return surveyCode;
    }
    public void setSurveyCode(String surveyCode) {
        this.surveyCode = surveyCode;
    }
    public String getQuestionCodeNext() {
        return questionCodeNext;
    }
    public void setQuestionCodeNext(String questionCodeNext) {
        this.questionCodeNext = questionCodeNext;
    }
    public int getIsRequired() {
        return isRequired;
    }
    public void setIsRequired(int isRequired) {
        this.isRequired = isRequired;
    }
    public int getSort() {
        return sort;
    }
    public void setSort(int sort) {
        this.sort = sort;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
}

+ 14 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyQuestionnaire;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface SurveyQuestionnaireDao extends PagingAndSortingRepository<SurveyQuestionnaire,Long>,JpaSpecificationExecutor<SurveyQuestionnaire> {
    @Query("select q from SurveyQuestionnaire q where q.surveyCode = ?1")
    List<SurveyQuestionnaire> findBySurveyCode(String surveyCode);
}

+ 8 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireOptionsDao.java

@ -0,0 +1,8 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyQuestionnaireOptions;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface SurveyQuestionnaireOptionsDao extends PagingAndSortingRepository<SurveyQuestionnaireOptions,Long>,JpaSpecificationExecutor<SurveyQuestionnaireOptions> {
}

+ 11 - 11
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java

@ -2,11 +2,11 @@ package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.survey.SurveyQuestionResult;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestions;
import com.yihu.wlyy.entity.survey.SurveyQuestionnaire;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.repository.survey.SurveyQuestionResultDao;
import com.yihu.wlyy.repository.survey.SurveyTemplateQuestionsDao;
import com.yihu.wlyy.repository.survey.SurveyQuestionnaireDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.util.HttpClientUtil;
@ -38,7 +38,7 @@ public class QuestionnaireManageService extends BaseJpaService {
    @Autowired
    private ManageSynergyWorkorderServicerDao workorderServicerDao;
    @Autowired
    private SurveyTemplateQuestionsDao templateQuestionDao;
    private SurveyQuestionnaireDao surveyQuestionnaireDao;
    @Autowired
    private SurveyQuestionResultDao questionResultDao;
    @Autowired
@ -129,7 +129,7 @@ public class QuestionnaireManageService extends BaseJpaService {
        String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?id=" + templateCode;
        String  response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功!")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
@ -147,21 +147,21 @@ public class QuestionnaireManageService extends BaseJpaService {
        String patient = questionResult.getPatientCode();
        String templateCode = questionResult.getTemplateCode();
        //获取模板问题
        List<SurveyTemplateQuestions> questionList = templateQuestionDao.findByTemplateCode(templateCode);
        List<SurveyQuestionnaire> questionList = surveyQuestionnaireDao.findBySurveyCode(templateCode);
        //查找选项和答案
        Map<String, Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*, sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
        String sql = "SELECT soa.*, sqo.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_questions_options sqo ON soa.options_code= sqo.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patient, templateCode});
        for (SurveyTemplateQuestions templateQuestion : questionList) {
        for (SurveyQuestionnaire question : questionList) {
            Map<String, Object> map = new HashMap<>();
            map.put("question", templateQuestion);
            String qusCode = templateQuestion.getCode();
            map.put("question", question);
            String qusCode = question.getCode();
            for (Map<String, Object> option : optionAnswersList) {
                if (option.get("question_code").equals(qusCode)) {
                    map.put("option", option);
                }
            }
            answerMap.put(templateQuestion.getSort() + "", map);
            answerMap.put(question.getSort() + "", map);
        }
        json.put("answer", answerMap);
        return json;
@ -171,7 +171,7 @@ public class QuestionnaireManageService extends BaseJpaService {
        String url = wlyyUrl + "third/synergy/questionnaire/getQuestionnaireDetail?id=" + surveyCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);

+ 4 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/ScreenResultManageService.java

@ -25,10 +25,10 @@ public class ScreenResultManageService {
     * @return
     */
    public JSONObject getScreenResultDetail(String code) {
        String url = wlyyUrl + "synergy/screen/getScreenResultDetail?code=" + code;
        String url = wlyyUrl + "third/synergy/screen/getScreenResultDetail?code=" + code;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
@ -40,10 +40,10 @@ public class ScreenResultManageService {
     * @return
     */
    public JSONObject getScreenDetail(String templateCode) {
        String url = wlyyUrl + "synergy/questionnaire/getAllQuestions?surveyTemplateCode=" + templateCode;
        String url = wlyyUrl + "third/synergy/questionnaire/getAllQuestions?surveyTemplateCode=" + templateCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
        if(jsonObject.getInteger("status") == 200){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);