|  | @ -29,10 +29,7 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.math.BigDecimal;
 | 
	
		
			
				|  |  | import java.util.ArrayList;
 | 
	
		
			
				|  |  | import java.util.Date;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * Created by Trick on 2019/9/6
 | 
	
	
		
			
				|  | @ -287,7 +284,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
	
		
			
				|  |  |             totalSql += " AND i.label_code ='"+label+"'";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(creater)){
 | 
	
		
			
				|  |  |             totalSql +=" AND  t.creater = '"+creater+"' ";
 | 
	
		
			
				|  |  |             totalSql +=" AND  t.creater_code = '"+creater+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 | 
	
	
		
			
				|  | @ -433,7 +430,13 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
	
		
			
				|  |  |     public Boolean saveSurveyTemplate(String tempJson,String tempQJson,String tempOpJson,String labelJson,String labelInspJson)throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         WlyySurveyTemplateDO temp = objectMapper.readValue(tempJson,WlyySurveyTemplateDO.class);
 | 
	
		
			
				|  |  |         String doctor = temp.getCreaterCode();
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(temp.getId())){
 | 
	
		
			
				|  |  |             WlyySurveyTemplateDO templateDO = surveyTemplateDao.findOne(temp.getId());
 | 
	
		
			
				|  |  |             if(null!=templateDO){
 | 
	
		
			
				|  |  |                 temp.setCreater(templateDO.getCreater());
 | 
	
		
			
				|  |  |                 temp.setCreaterCode(templateDO.getCreaterCode());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         temp = surveyTemplateDao.save(temp);
 | 
	
		
			
				|  |  |         //删除原有问题
 | 
	
		
			
				|  |  |         List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
 | 
	
	
		
			
				|  | @ -443,6 +446,12 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
	
		
			
				|  |  |         //新增问题
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(tempQJson)){
 | 
	
		
			
				|  |  |             List<WlyySurveyTemplateQuestionDO> questions = EntityUtils.jsonToList(tempQJson, WlyySurveyTemplateQuestionDO.class);
 | 
	
		
			
				|  |  |             for (WlyySurveyTemplateQuestionDO wlyySurveyTemplateQuestionDO:questions){
 | 
	
		
			
				|  |  |                 wlyySurveyTemplateQuestionDO.setTemplateCode(temp.getId());
 | 
	
		
			
				|  |  |                 wlyySurveyTemplateQuestionDO.setTitle(temp.getTitle());
 | 
	
		
			
				|  |  |                 wlyySurveyTemplateQuestionDO.setCode(wlyySurveyTemplateQuestionDO.getId());
 | 
	
		
			
				|  |  |                 wlyySurveyTemplateQuestionDO.setId(UUID.randomUUID().toString());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             surveyTemplateQuestionDao.save(questions);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -455,6 +464,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
	
		
			
				|  |  |         //保存新问题选项
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(tempOpJson)){
 | 
	
		
			
				|  |  |             List<WlyySurveyTemplateOptionDO> options = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
 | 
	
		
			
				|  |  |             for (WlyySurveyTemplateOptionDO wlyySurveyTemplateOptionDO:options){
 | 
	
		
			
				|  |  |                 wlyySurveyTemplateOptionDO.setTemplateCode(temp.getId());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             surveyTemplateOptionDao.save(options);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 |