|  | @ -0,0 +1,347 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.knowledge.service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.knowledge.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.knowledge.dao.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.mysql.query.BaseJpaService;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.Date;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * 常见问题
 | 
	
		
			
				|  |  |  * @wangzhinan
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @Service
 | 
	
		
			
				|  |  | public class BaseKnowledgeQuestionService extends BaseJpaService<BaseKnowledgeQuestion, BaseKnowledgeQuestionDao> {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private org.slf4j.Logger logger = LoggerFactory.getLogger(BaseKnowledgeQuestionService.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseKnowledgeQuestionDao questionDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseKnowledgeQuestionsDao questionsDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseKnowledgeQuestionsRelationDao questionsRelationDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseKnowledgeDictDao dictDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseKnowledgeFlowConfigurationRelationDao flowConfigurationRelationDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HibenateUtils hibenateUtils;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 新增常见问题
 | 
	
		
			
				|  |  |      * @param knowledgeQuestion
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BaseKnowledgeQuestion insertAndUpdateQuestion(BaseKnowledgeQuestion knowledgeQuestion){
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(knowledgeQuestion.getId())){
 | 
	
		
			
				|  |  |             BaseKnowledgeQuestion question = questionDao.findById(knowledgeQuestion.getId()).get();
 | 
	
		
			
				|  |  |             knowledgeQuestion.setDel(question.getDel());
 | 
	
		
			
				|  |  |             knowledgeQuestion.setSort(question.getSort());
 | 
	
		
			
				|  |  |             knowledgeQuestion.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             knowledgeQuestion.setDel(1);
 | 
	
		
			
				|  |  |             knowledgeQuestion.setSort(maxSort("base_knowledge_question")+1);
 | 
	
		
			
				|  |  |             knowledgeQuestion.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             knowledgeQuestion.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return questionDao.save(knowledgeQuestion);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取排序的序号
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param tableName
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public  Integer maxSort(String tableName){
 | 
	
		
			
				|  |  |         String sql = "SELECT MAX(sort) as sort from "+tableName+" where del=1  ";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sql);
 | 
	
		
			
				|  |  |         Integer count = 0;
 | 
	
		
			
				|  |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
	
		
			
				|  |  |             if (rstotal.get(0).get("sort")!=null){
 | 
	
		
			
				|  |  |                 count = Integer.parseInt(rstotal.get(0).get("sort").toString());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return count;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 删除常见问题
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void deleteQuestion(String id){
 | 
	
		
			
				|  |  |         questionDao.updateDelById(id, 0);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询问题列表
 | 
	
		
			
				|  |  |      * @param name
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      * @param status
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public MixEnvelop selectQuestionList(String name,String type,String status,Integer page,Integer size){
 | 
	
		
			
				|  |  |         String condition = " and del = 1 order by sort asc,create_time desc ";
 | 
	
		
			
				|  |  |         String sql = "SELECT\n" +
 | 
	
		
			
				|  |  |                 "\tid,\n" +
 | 
	
		
			
				|  |  |                 "\ttype,\n" +
 | 
	
		
			
				|  |  |                 "\tquestion_name AS questionName,\n" +
 | 
	
		
			
				|  |  |                 "\tsimilar_question_name AS similarQuestionName,\n" +
 | 
	
		
			
				|  |  |                 "\tanswer,\n" +
 | 
	
		
			
				|  |  |                 "\tstatus,\n" +
 | 
	
		
			
				|  |  |                 "\ttime,\n" +
 | 
	
		
			
				|  |  |                 "\tsort\n" +
 | 
	
		
			
				|  |  |                 "FROM\n" +
 | 
	
		
			
				|  |  |                 "\tbase_knowledge_question where 1=1 ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(name)){
 | 
	
		
			
				|  |  |             condition +=" and question_name like '"+name+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(type)){
 | 
	
		
			
				|  |  |             condition +=" and type ='"+type+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(status)){
 | 
	
		
			
				|  |  |             condition +=" and status ='"+type+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql+condition, page, size);
 | 
	
		
			
				|  |  |         String sqlCount ="select COUNT(1) as total from base_knowledge_question where 1=1 ";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sqlCount+condition);
 | 
	
		
			
				|  |  |         Long count = 0L;
 | 
	
		
			
				|  |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
	
		
			
				|  |  |             count = Long.parseLong(rstotal.get(0).get("total").toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccessListWithPage("success", list, page, size, count);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 根据id查询某一个问题详情
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BaseKnowledgeQuestion selectById(String id){
 | 
	
		
			
				|  |  |         return questionDao.findById(id).get();
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 问题设置排序
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @param flag 1上移2下移
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BaseKnowledgeQuestion setQuestionSortById(String id,Integer flag){
 | 
	
		
			
				|  |  |         BaseKnowledgeQuestion knowledgeQuestion = questionDao.findById(id).get();
 | 
	
		
			
				|  |  |         int sort = 0;
 | 
	
		
			
				|  |  |         if (flag==1){
 | 
	
		
			
				|  |  |             sort = knowledgeQuestion.getSort()-1;
 | 
	
		
			
				|  |  |             BaseKnowledgeQuestion knowledgeQuestion1= questionDao.selectBySort(sort);
 | 
	
		
			
				|  |  |             if (knowledgeQuestion1!=null){
 | 
	
		
			
				|  |  |                 knowledgeQuestion1.setSort(knowledgeQuestion.getSort()+1);
 | 
	
		
			
				|  |  |                 questionDao.save(knowledgeQuestion1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else if (flag==2){
 | 
	
		
			
				|  |  |             sort = knowledgeQuestion.getSort()+1;
 | 
	
		
			
				|  |  |             BaseKnowledgeQuestion knowledgeQuestion1= questionDao.selectBySort(sort);
 | 
	
		
			
				|  |  |             if (knowledgeQuestion1!=null){
 | 
	
		
			
				|  |  |                 knowledgeQuestion1.setSort(knowledgeQuestion.getSort()-1);
 | 
	
		
			
				|  |  |                 questionDao.save(knowledgeQuestion1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (sort!=0){
 | 
	
		
			
				|  |  |             knowledgeQuestion.setSort(sort);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return questionDao.save(knowledgeQuestion);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //=========================问题集合=============================
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 新增问题集合
 | 
	
		
			
				|  |  |      * @param knowledgeQuestions
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BaseKnowledgeQuestions insertAndUpdateQuestions(BaseKnowledgeQuestions knowledgeQuestions, List<BaseKnowledgeQuestionsRelation> questionsRelations){
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(knowledgeQuestions.getId())){
 | 
	
		
			
				|  |  |             BaseKnowledgeQuestions question = questionsDao.findById(knowledgeQuestions.getId()).get();
 | 
	
		
			
				|  |  |             knowledgeQuestions.setDel(question.getDel());
 | 
	
		
			
				|  |  |             knowledgeQuestions.setCount(questionsRelations.size());
 | 
	
		
			
				|  |  |             knowledgeQuestions.setSort(question.getSort());
 | 
	
		
			
				|  |  |             knowledgeQuestions.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |             questionsRelationDao.deleteByQuestionsId(question.getId());
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             knowledgeQuestions.setDel(1);
 | 
	
		
			
				|  |  |             knowledgeQuestions.setCount(questionsRelations.size());
 | 
	
		
			
				|  |  |             knowledgeQuestions.setSort(maxSort("base_knowledge_questions")+1);
 | 
	
		
			
				|  |  |             knowledgeQuestions.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             knowledgeQuestions.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         knowledgeQuestions = questionsDao.save(knowledgeQuestions);
 | 
	
		
			
				|  |  |         for (BaseKnowledgeQuestionsRelation questionsRelation:questionsRelations){
 | 
	
		
			
				|  |  |             questionsRelation.setQuestionsId(knowledgeQuestions.getId());
 | 
	
		
			
				|  |  |             questionsRelation.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             questionsRelation.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |             questionsRelationDao.save(questionsRelation);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return knowledgeQuestions;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 删除问题集合
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void deleteQuestions(String id){
 | 
	
		
			
				|  |  |         questionsDao.updateDelById(id, 0);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询问题集合列表
 | 
	
		
			
				|  |  |      * @param name
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      * @param status
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public MixEnvelop selectQuestionsList(String name,String type,String status,Integer page,Integer size){
 | 
	
		
			
				|  |  |         String condition = " and del = 1 order by sort asc,create_time desc ";
 | 
	
		
			
				|  |  |         String sql = "SELECT\n" +
 | 
	
		
			
				|  |  |                 "\tid,\n" +
 | 
	
		
			
				|  |  |                 "\tbusiness_type AS businessType,\n" +
 | 
	
		
			
				|  |  |                 "\tquestions_name AS questionsName,\n" +
 | 
	
		
			
				|  |  |                 "\tcount,\n" +
 | 
	
		
			
				|  |  |                 "\tdescription,\n" +
 | 
	
		
			
				|  |  |                 "\tstatus,\n" +
 | 
	
		
			
				|  |  |                 "\ttime,\n" +
 | 
	
		
			
				|  |  |                 "\tsort\n" +
 | 
	
		
			
				|  |  |                 "FROM\n" +
 | 
	
		
			
				|  |  |                 "\tbase_knowledge_questions where 1=1 ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(name)){
 | 
	
		
			
				|  |  |             condition +=" and questions_name like '"+name+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(type)){
 | 
	
		
			
				|  |  |             condition +=" and business_type ='"+type+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(status)){
 | 
	
		
			
				|  |  |             condition +=" and status ='"+type+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql+condition, page, size);
 | 
	
		
			
				|  |  |         for (Map<String,Object> map:list){
 | 
	
		
			
				|  |  |             String id = map.get("id").toString();
 | 
	
		
			
				|  |  |             List<BaseKnowledgeQuestionsRelation> questionsRelations = questionsRelationDao.selectByQuestionsId(id);
 | 
	
		
			
				|  |  |             for (BaseKnowledgeQuestionsRelation questionsRelation:questionsRelations){
 | 
	
		
			
				|  |  |                 BaseKnowledgeQuestion question = questionDao.findById(questionsRelation.getQuestionId()).get();
 | 
	
		
			
				|  |  |                 questionsRelation.setQuestion(question);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             map.put("questionsRelation",questionsRelations);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String sqlCount ="select COUNT(1) as total from base_knowledge_questions where 1=1 ";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sqlCount+condition);
 | 
	
		
			
				|  |  |         Long count = 0L;
 | 
	
		
			
				|  |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
	
		
			
				|  |  |             count = Long.parseLong(rstotal.get(0).get("total").toString());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return MixEnvelop.getSuccessListWithPage("success", list, page, size, count);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 根据id查询某一个问题集合详情
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BaseKnowledgeQuestions selectQuestionsById(String id){
 | 
	
		
			
				|  |  |         BaseKnowledgeQuestions questions = questionsDao.findById(id).get();
 | 
	
		
			
				|  |  |         String questionsId = questions.getId();
 | 
	
		
			
				|  |  |         List<BaseKnowledgeQuestionsRelation> questionsRelations = questionsRelationDao.selectByQuestionsId(questionsId);
 | 
	
		
			
				|  |  |         for (BaseKnowledgeQuestionsRelation questionsRelation:questionsRelations){
 | 
	
		
			
				|  |  |             BaseKnowledgeQuestion question = questionDao.findById(questionsRelation.getQuestionId()).get();
 | 
	
		
			
				|  |  |             questionsRelation.setQuestion(question);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         questions.setQuestionsRelations(questionsRelations);
 | 
	
		
			
				|  |  |         return questions;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 问题集合设置排序
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @param flag 1上移2下移
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BaseKnowledgeQuestions setQuestionsSortById(String id,Integer flag){
 | 
	
		
			
				|  |  |         BaseKnowledgeQuestions knowledgeQuestions = questionsDao.findById(id).get();
 | 
	
		
			
				|  |  |         int sort = 0;
 | 
	
		
			
				|  |  |         if (flag==1){
 | 
	
		
			
				|  |  |             sort = knowledgeQuestions.getSort()-1;
 | 
	
		
			
				|  |  |             BaseKnowledgeQuestions knowledgeQuestions1= questionsDao.selectBySort(sort);
 | 
	
		
			
				|  |  |             if (knowledgeQuestions1!=null){
 | 
	
		
			
				|  |  |                 knowledgeQuestions1.setSort(knowledgeQuestions.getSort()+1);
 | 
	
		
			
				|  |  |                 questionsDao.save(knowledgeQuestions1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }else if (flag==2){
 | 
	
		
			
				|  |  |             sort = knowledgeQuestions.getSort()+1;
 | 
	
		
			
				|  |  |             BaseKnowledgeQuestions knowledgeQuestions1= questionsDao.selectBySort(sort);
 | 
	
		
			
				|  |  |             if (knowledgeQuestions1!=null){
 | 
	
		
			
				|  |  |                 knowledgeQuestions1.setSort(knowledgeQuestions.getSort()-1);
 | 
	
		
			
				|  |  |                 questionsDao.save(knowledgeQuestions1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (sort!=0){
 | 
	
		
			
				|  |  |             knowledgeQuestions.setSort(sort);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return questionsDao.save(knowledgeQuestions);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //=========================流程配置关联===========================================
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 关联设置
 | 
	
		
			
				|  |  |      * @param flowConfigurationRelations
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<BaseKnowledgeFlowConfigurationRelation> setQuestionConfigurationRelation(List<BaseKnowledgeFlowConfigurationRelation> flowConfigurationRelations){
 | 
	
		
			
				|  |  |         for (BaseKnowledgeFlowConfigurationRelation flowConfigurationRelation:flowConfigurationRelations){
 | 
	
		
			
				|  |  |             flowConfigurationRelation.setCreateTime(new Date());
 | 
	
		
			
				|  |  |             flowConfigurationRelation.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |             flowConfigurationRelationDao.save(flowConfigurationRelation);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (flowConfigurationRelations!=null&&flowConfigurationRelations.size()!=0){
 | 
	
		
			
				|  |  |             BaseKnowledgeFlowConfigurationRelation configurationRelation = flowConfigurationRelations.get(0);
 | 
	
		
			
				|  |  |             questionDao.updateFlagById(configurationRelation.getQuestionId(),1);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return flowConfigurationRelations;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 根据问题id获取问题关联配置
 | 
	
		
			
				|  |  |      * @param questionId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<BaseKnowledgeFlowConfigurationRelation> selectFlowConfigurationRelations(String questionId){
 | 
	
		
			
				|  |  |         List<BaseKnowledgeFlowConfigurationRelation> flowConfigurationRelations = flowConfigurationRelationDao.selectByQuestionId(questionId);
 | 
	
		
			
				|  |  |         for (BaseKnowledgeFlowConfigurationRelation flowConfigurationRelation:flowConfigurationRelations){
 | 
	
		
			
				|  |  |             if (flowConfigurationRelation.getRelationCode().equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |                 flowConfigurationRelation.setQuestion(questionDao.findById(flowConfigurationRelation.getRelationCode()).get());
 | 
	
		
			
				|  |  |             }else if (flowConfigurationRelation.getRelationCode().equalsIgnoreCase("2")){
 | 
	
		
			
				|  |  |                 flowConfigurationRelation.setDict(dictDao.findById(flowConfigurationRelation.getRelationCode()).get());
 | 
	
		
			
				|  |  |             }else if (flowConfigurationRelation.getRelationCode().equalsIgnoreCase("3")){
 | 
	
		
			
				|  |  |                 flowConfigurationRelation.setQuestions(questionsDao.findById(flowConfigurationRelation.getRelationCode()).get());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return flowConfigurationRelations;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |