Browse Source

问卷调查管理端,居民端

wujunjie 8 years ago
parent
commit
ce5132c686

+ 6 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplateQuestionsDao.java

@ -16,10 +16,14 @@ public interface SurveyTemplateQuestionsDao extends PagingAndSortingRepository<S
    @Query("select  t from SurveyTemplateQuestions t where t.templateCode = ?1 and t.code = ?2 ")
    SurveyTemplateQuestions findById(String tempCode, String qstCode);
//String code, String title, String questionComment, Integer questionType, String templateCode, Integer isRequired, Integer minNum, Integer maxNum,
    @Query("select  t.code from SurveyTemplateQuestions t where t.templateCode = ?1 and t.sort = ?2 ")
    String findBySort(String tempCode, Object sort);
    //String code, String title, String questionComment, Integer questionType, String templateCode, Integer isRequired, Integer minNum, Integer maxNum,
// Integer sort, String questionCodeNext, String questionSortNext, Integer del, Date createTime, Date updateTime
    @Modifying
    @Query("update SurveyTemplateQuestions t set t.title=?3,t.questionComment=?4,t.questionType=?5," +
            "t.isRequired=?6,t.minNum=?7,t.maxNum=?8,t.sort=?9,t.questionCodeNext=?10,t.questionSortNext=?11 where t.templateCode = ?1 and t.code = ?2 ")
    void modifyQuestion(String tempCode, String qstCode,String qstTitle, String qstComment, int qstType, int isRequired,int minNum,int  maxNum, int sort,String next);
    void modifyQuestion(String tempCode, String qstCode, String qstTitle, String qstComment, int qstType, int isRequired, int minNum, int maxNum, int sort, String next);
}

+ 17 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -333,7 +333,8 @@ public class ManagerQuestionnaireService extends BaseService {
                        int optionDel = 1;
                        String optionNextQuestion = null;
                        if (!StringUtils.isEmpty(tempOption.get("nextQuestion").toString())) {
                            optionNextQuestion = tempOption.get("nextQuestion").toString();
//                            optionNextQuestion = tempOption.get("nextQuestion").toString();
                            optionNextQuestion = surveyTemplateQuestionsDao.findBySort(templateCode,tempOption.get("nextQuestion"));
                        }
//                        自主创建,插入表
                        SurveyQuestionnaireOptions surveyQuestionnaireOptions = new SurveyQuestionnaireOptions();
@ -396,7 +397,8 @@ public class ManagerQuestionnaireService extends BaseService {
                        int optionDel = 1;
                        String optionNextQuestion = null;
                        if (!StringUtils.isEmpty(tempOption.get("nextQuestion").toString())) {
                            optionNextQuestion = tempOption.get("nextQuestion").toString();
//                            optionNextQuestion = tempOption.get("nextQuestion").toString();
                            optionNextQuestion = surveyTemplateQuestionsDao.findBySort(templateCode,tempOption.get("nextQuestion"));
                        }
//                        自主创建,插入表
@ -426,7 +428,8 @@ public class ManagerQuestionnaireService extends BaseService {
//            问答特有属性
                    String nextQuestion = null;
                    if (tempQestion.has("nextQuestion")) {
                        nextQuestion = tempQestion.get("nextQuestion").toString();
//                        nextQuestion = tempQestion.get("nextQuestion").toString();
                        nextQuestion = surveyTemplateQuestionsDao.findBySort(templateCode,tempQestion.get("nextQuestion"));
                    }
                    SurveyQuestionnaire surveyQuestionnaire2 = new SurveyQuestionnaire();
                    surveyQuestionnaire2.setCode(questionnaireCode);
@ -620,6 +623,14 @@ public class ManagerQuestionnaireService extends BaseService {
            int isRequired = questionnair.getIsRequired();
            int sort = questionnair.getSort();
            int type = questionnair.getQuestionType();
            if (questionnair.getMaxNum()!= null) {
                int maxNum = questionnair.getMaxNum();
                question.put("maxNum", maxNum);
            }
            if (questionnair.getMinNum() != null) {
                int minNum = questionnair.getMinNum();
                question.put("minNum", minNum);
            }
            if (questionnair.getQuestionComment() != null) {
                String comment = questionnair.getQuestionComment();
                question.put("comment", comment);
@ -642,6 +653,8 @@ public class ManagerQuestionnaireService extends BaseService {
                if (option.getQuestionCodeNext() != null) {
                    String next = option.getQuestionCodeNext();
                    SurveyQuestionnaire sq = surveyQuestionnaireDao.findByIdAndQstId(id, next);
                    System.out.println("=============qstcode============== " + qstcode);
                    System.out.println("=============optCode============== " + option.getCode());
                    System.out.println("=============sq============== " + sq);
                    System.out.println("=============next============== " + next);
                    opt.put("nextQuestion", sq.getSort());
@ -1476,6 +1489,7 @@ public class ManagerQuestionnaireService extends BaseService {
            this.code = code;
            this.codes = codes;
            this.accessToken = accessToken;
            System.out.println("survey_id >>>>>>"+code);
        }
        @Override
@ -1486,9 +1500,6 @@ public class ManagerQuestionnaireService extends BaseService {
                    Patient p = patientDao.findByCode(cod);
                    String name = p.getName();
                    String openId = p.getOpenid();
                /*String name = "吴俊杰";
                String openId = "o7NFZw1QM4YR1O19mLjwfX1Hh11A";
                cod = "jojojojpkpokpko";*/
                    json.put("keyword2", sdf.format(new Date()));
                    json.put("toUser", cod);
                    json.put("first", name + ",您好!为了给您提供更好的家庭医生健康服务,现有一份问卷需要您填写。");

+ 5 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java

@ -395,7 +395,11 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
            if (num==0){
                return write(200, "保存成功!");
            }else {
                return write(-1, "标题重复!","data",num);
                Map map = new HashMap();
//              标题重复码
                map.put("errorCode","001");
                map.put("number",num);
                return write(-1, "标题重复!","data",map);
            }
        } catch (Exception e) {
            e.printStackTrace();