Просмотр исходного кода

Merge branch 'dev' of humingfen/patient-co-management into dev

huangwenjie 6 лет назад
Родитель
Сommit
6dc0375150

+ 3 - 3
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java

@ -32,7 +32,7 @@ public class CustomerQuestionnaireController extends BaseController {
    public String saveAnswer( @ApiParam(value = "问卷题目及选项", required = true)@RequestParam String jsonData,
                              @ApiParam(value = "客服code", required = true)@RequestParam(value = "customerCode")String customerCode,
                              @ApiParam(value = "居民code", required = true)@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签(疾病筛查问卷要传5,否则可不传)", required = false)@RequestParam(value = "labelType")Integer labelType,
                              @ApiParam(value = "问卷标签(疾病筛查问卷要传5,调查问卷传4)", required = false)@RequestParam(value = "labelType")Integer labelType,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)", required = false, defaultValue = "1")@RequestParam(value = "source")Integer source,
                              @ApiParam(value = "协同工单服务对象表code", required = true)@RequestParam(value = "serviceCode")String serviceCode) {
        try {
@ -45,9 +45,9 @@ public class CustomerQuestionnaireController extends BaseController {
    @RequestMapping(value = "getAnswers", method = RequestMethod.GET)
    @ApiOperation(value = "查看调查统计结果")
    public String getAnswers(@ApiParam(value = "问卷code", required = true) @RequestParam String templateCode) {
    public String getAnswers(@ApiParam(value = "问卷code", required = true) @RequestParam String surveyCode) {
        try {
            return write(200, "查询成功!", "data", questionnaireService.getAnswers(templateCode));
            return write(200, "查询成功!", "data", questionnaireService.getAnswers(surveyCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");

+ 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> {
}

+ 14 - 14
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
@ -122,14 +122,14 @@ public class QuestionnaireManageService extends BaseJpaService {
    /**
     * 查看调查问卷统计结果
     * @param templateCode
     * @param surveyCode
     * @return
     */
    public JSONObject getAnswers(String templateCode) {
        String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?id=" + templateCode;
    public JSONObject getAnswers(String surveyCode) {
        String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?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);
@ -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);

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -769,6 +769,7 @@ public class ManagerQuestionnaireService extends BaseService {
                opt.put("sort", st);
                opt.put("haveComment", haveComment);
                opt.put("isRequired", required);
                opt.put("optionCode", option.getCode());
                optList.add(opt);
            }
@ -776,6 +777,7 @@ public class ManagerQuestionnaireService extends BaseService {
            question.put("type", type);
            question.put("isRequired", isRequired);
            question.put("sort", sort);
            question.put("qstCode", qstcode);
            question.put("options", optList);
            questions.add(question);
        }