|  | @ -21,6 +21,7 @@ import com.yihu.jw.utils.EntityUtils;
 | 
												
													
														
															|  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
												
													
														
															|  | import com.yihu.mysql.query.BaseJpaService;
 |  | import com.yihu.mysql.query.BaseJpaService;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
													
														
															|  | 
 |  | import org.apache.xpath.operations.Bool;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Value;
 |  | import org.springframework.beans.factory.annotation.Value;
 | 
												
													
														
															|  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 |  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 | 
												
											
												
													
														
															|  | @ -29,10 +30,7 @@ import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | import org.springframework.transaction.annotation.Transactional;
 |  | import org.springframework.transaction.annotation.Transactional;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import java.math.BigDecimal;
 |  | 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
 |  |  * Created by Trick on 2019/9/6
 | 
												
											
												
													
														
															|  | @ -107,7 +105,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //计算总数
 |  |         //计算总数
 | 
												
													
														
															|  |         String totalSql ="SELECT" +
 |  |         String totalSql ="SELECT" +
 | 
												
													
														
															|  |                 " COUNT(1) AS total" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " COUNT(1) AS \"total\"" +
 | 
												
													
														
															|  |                 " FROM" +
 |  |                 " FROM" +
 | 
												
													
														
															|  |                 " wlyy_survey_question q " +
 |  |                 " wlyy_survey_question q " +
 | 
												
													
														
															|  |                 " WHERE q.del = '1' ";
 |  |                 " WHERE q.del = '1' ";
 | 
												
											
												
													
														
															|  | @ -125,21 +123,21 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 | 
												
													
														
															|  |         Long count = 0L;
 |  |         Long count = 0L;
 | 
												
													
														
															|  |         if (rstotal != null && rstotal.size() > 0) {
 |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
												
													
														
															|  |             count = (Long) rstotal.get(0).get("total");
 |  | 
 | 
												
													
														
															|  | 
 |  |             count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //计算总数
 |  |         //计算总数
 | 
												
													
														
															|  |         String sql ="SELECT " +
 |  |         String sql ="SELECT " +
 | 
												
													
														
															|  |                 " q.id AS id, " +
 |  | 
 | 
												
													
														
															|  |                 " q.title AS title, " +
 |  | 
 | 
												
													
														
															|  |                 " q.question_comment AS questionComment, " +
 |  | 
 | 
												
													
														
															|  |                 " q.question_type AS questionType, " +
 |  | 
 | 
												
													
														
															|  |                 " q.is_required AS isRequired, " +
 |  | 
 | 
												
													
														
															|  |                 " q.min_num AS minNum, " +
 |  | 
 | 
												
													
														
															|  |                 " q.max_num AS maxNum, " +
 |  | 
 | 
												
													
														
															|  |                 " q.del, " +
 |  | 
 | 
												
													
														
															|  |                 " q.create_time AS createTime, " +
 |  | 
 | 
												
													
														
															|  |                 " q.update_time AS updateTime " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " q.id AS \"id\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.title AS \"title\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.question_comment AS \"questionComment\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.question_type AS \"questionType\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.is_required AS \"isRequired\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.min_num AS \"minNum\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.max_num AS \"maxNum\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.del as \"del\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.create_time AS \"createTime\", " +
 | 
												
													
														
															|  | 
 |  |                 " q.update_time AS \"updateTime\" " +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_question q " +
 |  |                 " wlyy_survey_question q " +
 | 
												
													
														
															|  |                 " WHERE q.del = '1' ";
 |  |                 " WHERE q.del = '1' ";
 | 
												
											
												
													
														
															|  | @ -154,8 +152,23 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(creater)){
 |  |         if (StringUtils.isNoneBlank(creater)){
 | 
												
													
														
															|  |             sql+=" AND q.creater ='"+creater+"' ";
 |  |             sql+=" AND q.creater ='"+creater+"' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         sql += " ORDER BY q.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql += " ORDER BY q.create_time DESC  ";
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (flag){
 | 
												
													
														
															|  | 
 |  |                 sql ="SELECT * FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "( SELECT A.*, ROWNUM RN FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "    ("+sql+") A \n" +
 | 
												
													
														
															|  | 
 |  |                         "    WHERE ROWNUM <= "+page*size+" ) \n" +
 | 
												
													
														
															|  | 
 |  |                         "       WHERE RN >= "+((page-1)*size+1);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         List<WlyySurveyQuestionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyQuestionVO.class));
 |  |         List<WlyySurveyQuestionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyQuestionVO.class));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if(list!=null&&list.size()>0){
 |  |         if(list!=null&&list.size()>0){
 | 
												
											
												
													
														
															|  | @ -197,6 +210,11 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //保存问题
 |  |         //保存问题
 | 
												
													
														
															|  |         List<WlyySurveyQuestionDO> surveys = EntityUtils.jsonToList(sqjsons, WlyySurveyQuestionDO.class);
 |  |         List<WlyySurveyQuestionDO> surveys = EntityUtils.jsonToList(sqjsons, WlyySurveyQuestionDO.class);
 | 
												
													
														
															|  | 
 |  |         for (WlyySurveyQuestionDO wlyySurveyQuestionDO:surveys){
 | 
												
													
														
															|  | 
 |  |             wlyySurveyQuestionDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |             wlyySurveyQuestionDO.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         surveyQuestionDao.save(surveys);
 |  |         surveyQuestionDao.save(surveys);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if(surveys!=null&&surveys.size()>0){
 |  |         if(surveys!=null&&surveys.size()>0){
 | 
												
											
												
													
														
															|  | @ -223,6 +241,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public Boolean updataSurveyQuestion(String sqjson,String sqOptionJson) throws Exception{
 |  |     public Boolean updataSurveyQuestion(String sqjson,String sqOptionJson) throws Exception{
 | 
												
													
														
															|  |         WlyySurveyQuestionDO sq = objectMapper.readValue(sqjson,WlyySurveyQuestionDO.class);
 |  |         WlyySurveyQuestionDO sq = objectMapper.readValue(sqjson,WlyySurveyQuestionDO.class);
 | 
												
													
														
															|  | 
 |  |         sq.setUpdateTime(new Date());
 | 
												
													
														
															|  |         surveyQuestionDao.save(sq);
 |  |         surveyQuestionDao.save(sq);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(sq.getId(),"1");
 |  |         List<WlyySurveyQuestionsOptionDO> optionDOs = surveyQuestionsOptionDao.findByQuestionCodeAndDelOrderBySortAsc(sq.getId(),"1");
 | 
												
											
												
													
														
															|  | @ -272,7 +291,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |     public MixEnvelop findSurveyTemplate(String title,String creater,String label,Integer page,Integer size){
 |  |     public MixEnvelop findSurveyTemplate(String title,String creater,String label,Integer page,Integer size){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String totalSql ="SELECT " +
 |  |         String totalSql ="SELECT " +
 | 
												
													
														
															|  |                 " COUNT(1) AS total" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " COUNT(1) AS \"total\"" +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_template t ";
 |  |                 " wlyy_survey_template t ";
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(label)){
 |  |         if(StringUtils.isNotBlank(label)){
 | 
												
											
												
													
														
															|  | @ -287,26 +306,26 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |             totalSql += " AND i.label_code ='"+label+"'";
 |  |             totalSql += " AND i.label_code ='"+label+"'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(creater)){
 |  |         if (StringUtils.isNoneBlank(creater)){
 | 
												
													
														
															|  |             totalSql +=" AND  t.creater = '"+creater+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             totalSql +=" AND  t.creater_code = '"+creater+"' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 | 
												
													
														
															|  |         Long count = 0L;
 |  |         Long count = 0L;
 | 
												
													
														
															|  |         if (rstotal != null && rstotal.size() > 0) {
 |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
												
													
														
															|  |             count = (Long) rstotal.get(0).get("total");
 |  | 
 | 
												
													
														
															|  | 
 |  |             count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sql = "SELECT " +
 |  |         String sql = "SELECT " +
 | 
												
													
														
															|  |                 " t.id, " +
 |  | 
 | 
												
													
														
															|  |                 " t.title, " +
 |  | 
 | 
												
													
														
															|  |                 " t.template_comment AS templateComment, " +
 |  | 
 | 
												
													
														
															|  |                 " t.organization, " +
 |  | 
 | 
												
													
														
															|  |                 " t.creater, " +
 |  | 
 | 
												
													
														
															|  |                 " t.creater_code, " +
 |  | 
 | 
												
													
														
															|  |                 " t.create_time AS createTime, " +
 |  | 
 | 
												
													
														
															|  |                 " t.del, " +
 |  | 
 | 
												
													
														
															|  |                 " t.update_time AS updateTime" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " t.id as \"id\",  " +
 | 
												
													
														
															|  | 
 |  |                 " t.title as \"title\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.template_comment AS \"templateComment\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.organization AS \"organization\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.creater AS \"creater\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.creater_code AS \"createrCode\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.create_time AS \"createTime\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.del AS \"del\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.update_time AS \"updateTime\"" +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_template t ";
 |  |                 " wlyy_survey_template t ";
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(label)){
 |  |         if(StringUtils.isNotBlank(label)){
 | 
												
											
												
													
														
															|  | @ -323,7 +342,23 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(creater)){
 |  |         if (StringUtils.isNoneBlank(creater)){
 | 
												
													
														
															|  |             sql +=" AND  t.creater_code = '"+creater+"' ";
 |  |             sql +=" AND  t.creater_code = '"+creater+"' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
 |  | 
 | 
												
													
														
															|  | 
 |  |         sql += " ORDER BY t.create_time DESC  ";
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (!flag){
 | 
												
													
														
															|  | 
 |  |                 sql ="SELECT * FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "( SELECT A.*, ROWNUM RN FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "    ("+sql+") A \n" +
 | 
												
													
														
															|  | 
 |  |                         "    WHERE ROWNUM <= "+page*size+" ) \n" +
 | 
												
													
														
															|  | 
 |  |                         "       WHERE RN >= "+((page-1)*size+1);
 | 
												
													
														
															|  | 
 |  |                 System.out.println(sql);
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<WlyySurveyTemplateVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyTemplateVO.class));
 |  |         List<WlyySurveyTemplateVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyTemplateVO.class));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -397,15 +432,19 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |             //设置问题
 |  |             //设置问题
 | 
												
													
														
															|  |             List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
 |  |             List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
 | 
												
													
														
															|  |             convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
 |  |             convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
 | 
												
													
														
															|  |             templateVO.setTemplateQuestionVOs(tqVOs);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             //设置选项
 |  |             //设置选项
 | 
												
													
														
															|  |             for(WlyySurveyTemplateQuestionVO tq:tqVOs){
 |  |             for(WlyySurveyTemplateQuestionVO tq:tqVOs){
 | 
												
													
														
															|  |                 List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),tq.getTemplateCode(),"1");
 |  | 
 | 
												
													
														
															|  | 
 |  |                 List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getCode(),tq.getTemplateCode(),"1");
 | 
												
													
														
															|  |                 List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
 |  |                 List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
 | 
												
													
														
															|  |                 convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
 |  |                 convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
 | 
												
													
														
															|  | 
 |  |                 for (WlyySurveyTemplateOptionVO optionVO:optionVOs){
 | 
												
													
														
															|  | 
 |  |                     optionVO.setId(optionVO.getCode());
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  |                 tq.setOptionVOs(optionVOs);
 |  |                 tq.setOptionVOs(optionVOs);
 | 
												
													
														
															|  | 
 |  |                 tq.setId(tq.getCode());
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  |             templateVO.setTemplateQuestionVOs(tqVOs);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return templateVO;
 |  |         return templateVO;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
											
												
													
														
															|  | @ -433,7 +472,16 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |     public Boolean saveSurveyTemplate(String tempJson,String tempQJson,String tempOpJson,String labelJson,String labelInspJson)throws Exception{
 |  |     public Boolean saveSurveyTemplate(String tempJson,String tempQJson,String tempOpJson,String labelJson,String labelInspJson)throws Exception{
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         WlyySurveyTemplateDO temp = objectMapper.readValue(tempJson,WlyySurveyTemplateDO.class);
 |  |         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.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         temp.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |         temp.setUpdateTime(new Date());
 | 
												
													
														
															|  |         temp = surveyTemplateDao.save(temp);
 |  |         temp = surveyTemplateDao.save(temp);
 | 
												
													
														
															|  |         //删除原有问题
 |  |         //删除原有问题
 | 
												
													
														
															|  |         List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
 |  |         List<WlyySurveyTemplateQuestionDO> questionDODels = surveyTemplateQuestionDao.findByTemplateCodeAndDelOrderBySortAsc(temp.getId(),"1");
 | 
												
											
												
													
														
															|  | @ -443,6 +491,14 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         //新增问题
 |  |         //新增问题
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(tempQJson)){
 |  |         if(StringUtils.isNotBlank(tempQJson)){
 | 
												
													
														
															|  |             List<WlyySurveyTemplateQuestionDO> questions = EntityUtils.jsonToList(tempQJson, WlyySurveyTemplateQuestionDO.class);
 |  |             List<WlyySurveyTemplateQuestionDO> questions = EntityUtils.jsonToList(tempQJson, WlyySurveyTemplateQuestionDO.class);
 | 
												
													
														
															|  | 
 |  |             for (WlyySurveyTemplateQuestionDO wlyySurveyTemplateQuestionDO:questions){
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateQuestionDO.setTemplateCode(temp.getId());
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateQuestionDO.setCode(wlyySurveyTemplateQuestionDO.getId());
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateQuestionDO.setId(UUID.randomUUID().toString());
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateQuestionDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateQuestionDO.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |             surveyTemplateQuestionDao.save(questions);
 |  |             surveyTemplateQuestionDao.save(questions);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -455,6 +511,12 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         //保存新问题选项
 |  |         //保存新问题选项
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(tempOpJson)){
 |  |         if(StringUtils.isNotBlank(tempOpJson)){
 | 
												
													
														
															|  |             List<WlyySurveyTemplateOptionDO> options = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
 |  |             List<WlyySurveyTemplateOptionDO> options = EntityUtils.jsonToList(tempOpJson, WlyySurveyTemplateOptionDO.class);
 | 
												
													
														
															|  | 
 |  |             for (WlyySurveyTemplateOptionDO wlyySurveyTemplateOptionDO:options){
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateOptionDO.setTemplateCode(temp.getId());
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateOptionDO.setCode(wlyySurveyTemplateOptionDO.getId());
 | 
												
													
														
															|  | 
 |  |                 wlyySurveyTemplateOptionDO.setId(UUID.randomUUID()+"");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |             surveyTemplateOptionDao.save(options);
 |  |             surveyTemplateOptionDao.save(options);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -562,9 +624,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public List<Map<String,Object>> findSurveyByDept(String dept){
 |  |     public List<Map<String,Object>> findSurveyByDept(String dept){
 | 
												
													
														
															|  |         String sql = "SELECT " +
 |  |         String sql = "SELECT " +
 | 
												
													
														
															|  |                 " t.id, " +
 |  | 
 | 
												
													
														
															|  |                 " t.title, " +
 |  | 
 | 
												
													
														
															|  |                 " t.template_comment AS templateComment " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " t.id as \"id\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.title as \"title\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.template_comment AS \"templateComment\" " +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_template t " +
 |  |                 " wlyy_survey_template t " +
 | 
												
													
														
															|  |                 " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
 |  |                 " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
 | 
												
											
												
													
														
															|  | @ -580,7 +642,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         if(result!=null&&result.size()>0){
 |  |         if(result!=null&&result.size()>0){
 | 
												
													
														
															|  |             for(Map<String,Object> map:result){
 |  |             for(Map<String,Object> map:result){
 | 
												
													
														
															|  |                 String tempId = (String)map.get("id");
 |  |                 String tempId = (String)map.get("id");
 | 
												
													
														
															|  |                 List<WlyySurveyUserDO> list = surveyUserDao.findBySurvey(tempId,patient, DateUtil.strToDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")));
 |  | 
 | 
												
													
														
															|  | 
 |  |                 List<WlyySurveyUserDO> list = surveyUserDao.findBySurvey(tempId,patient);
 | 
												
													
														
															|  |                 if(list!=null&&list.size()>0){
 |  |                 if(list!=null&&list.size()>0){
 | 
												
													
														
															|  |                     map.put("isAnswer",true);
 |  |                     map.put("isAnswer",true);
 | 
												
													
														
															|  |                 }else{
 |  |                 }else{
 | 
												
											
												
													
														
															|  | @ -598,9 +660,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |     */
 |  |     */
 | 
												
													
														
															|  |     public List<Map<String,Object>> findDeptBySurvey(String tempId){
 |  |     public List<Map<String,Object>> findDeptBySurvey(String tempId){
 | 
												
													
														
															|  |         String sql ="SELECT " +
 |  |         String sql ="SELECT " +
 | 
												
													
														
															|  |                 " d.survey_temp_code AS surveyTempCode," +
 |  | 
 | 
												
													
														
															|  |                 " d.dept, " +
 |  | 
 | 
												
													
														
															|  |                 " d.dept_name AS deptName " +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " d.survey_temp_code AS \"surveyTempCode\"," +
 | 
												
													
														
															|  | 
 |  |                 " d.dept AS \"dept\", " +
 | 
												
													
														
															|  | 
 |  |                 " d.dept_name AS \"deptName\" " +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_template t " +
 |  |                 " wlyy_survey_template t " +
 | 
												
													
														
															|  |                 " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
 |  |                 " JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
 | 
												
											
												
													
														
															|  | @ -635,6 +697,10 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |             List<WlyySurveyUserAnswerDO> answerDOs = EntityUtils.jsonToList(suaJsons,WlyySurveyUserAnswerDO.class);
 |  |             List<WlyySurveyUserAnswerDO> answerDOs = EntityUtils.jsonToList(suaJsons,WlyySurveyUserAnswerDO.class);
 | 
												
													
														
															|  |             for(WlyySurveyUserAnswerDO answerDO : answerDOs){
 |  |             for(WlyySurveyUserAnswerDO answerDO : answerDOs){
 | 
												
													
														
															|  |                 answerDO.setSurverUserId(surveyUserDO.getId());
 |  |                 answerDO.setSurverUserId(surveyUserDO.getId());
 | 
												
													
														
															|  | 
 |  |                 answerDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |                 /*WlyySurveyTemplateOptionDO surveyTemplateOptionDO = surveyTemplateOptionDao.findOne(answerDO.getTempOptionCode());
 | 
												
													
														
															|  | 
 |  |                 answerDO.setTempQuestionCode(surveyTemplateOptionDO.getQuestionCode());
 | 
												
													
														
															|  | 
 |  |                 answerDO.setTempOptionCode(surveyTemplateOptionDO.getCode());*/
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             surveyUserAnswerDao.save(answerDOs);
 |  |             surveyUserAnswerDao.save(answerDOs);
 | 
												
													
														
															|  |             BasePatientBusinessDO basePatientBusinessDO = basePatientBusinessDao.findByDoctorPatientRelationCode(surveyUserDO.getPatient(),surveyUserDO.getSurveyTempCode(),surveyUserDO.getDoctor());
 |  |             BasePatientBusinessDO basePatientBusinessDO = basePatientBusinessDao.findByDoctorPatientRelationCode(surveyUserDO.getPatient(),surveyUserDO.getSurveyTempCode(),surveyUserDO.getDoctor());
 | 
												
											
												
													
														
															|  | @ -654,9 +720,11 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(surverUserId)){
 |  |         if(StringUtils.isNotBlank(surverUserId)){
 | 
												
													
														
															|  |             list = surveyUserAnswerDao.findBySurverUserId(surverUserId);
 |  |             list = surveyUserAnswerDao.findBySurverUserId(surverUserId);
 | 
												
													
														
															|  |         }else{
 |  |         }else{
 | 
												
													
														
															|  |             List<WlyySurveyUserDO> surveys = surveyUserDao.findBySurvey(tempId,patient, DateUtil.strToDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")));
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<WlyySurveyUserDO> surveys = surveyUserDao.findBySurvey(tempId,patient);
 | 
												
													
														
															|  | 
 |  |             System.out.println(surveys);
 | 
												
													
														
															|  |             if(surveys!=null&&surveys.size()>0){
 |  |             if(surveys!=null&&surveys.size()>0){
 | 
												
													
														
															|  |                 WlyySurveyUserDO wlyySurveyUserDO = surveys.get(0);
 |  |                 WlyySurveyUserDO wlyySurveyUserDO = surveys.get(0);
 | 
												
													
														
															|  | 
 |  |                 System.out.println(wlyySurveyUserDO);
 | 
												
													
														
															|  |                 list = surveyUserAnswerDao.findBySurverUserId(wlyySurveyUserDO.getId());
 |  |                 list = surveyUserAnswerDao.findBySurverUserId(wlyySurveyUserDO.getId());
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -680,7 +748,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |             templateVO.setVisitDeptName(doctor.getVisitDeptName());
 |  |             templateVO.setVisitDeptName(doctor.getVisitDeptName());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         //查询所有答题过的用户,计算答题总数
 |  |         //查询所有答题过的用户,计算答题总数
 | 
												
													
														
															|  |         List<WlyySurveyUserDO> surveyUsers = surveyUserDao.findBySurveyTempCodeAndStatus(templateVO.getId(),1);
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<WlyySurveyUserDO> surveyUsers = surveyUserDao.findBySurveyTempCodeAndStatus(tempId,1);
 | 
												
													
														
															|  |         Integer total =0;
 |  |         Integer total =0;
 | 
												
													
														
															|  |         if(surveyUsers!=null&&surveyUsers.size()>0){
 |  |         if(surveyUsers!=null&&surveyUsers.size()>0){
 | 
												
													
														
															|  |             total = surveyUsers.size();
 |  |             total = surveyUsers.size();
 | 
												
											
												
													
														
															|  | @ -692,15 +760,14 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |             //设置问题
 |  |             //设置问题
 | 
												
													
														
															|  |             List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
 |  |             List<WlyySurveyTemplateQuestionVO> tqVOs = new ArrayList<>();
 | 
												
													
														
															|  |             convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
 |  |             convertToModels(tqDOs,tqVOs,WlyySurveyTemplateQuestionVO.class);
 | 
												
													
														
															|  |             templateVO.setTemplateQuestionVOs(tqVOs);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             //设置选项
 |  |             //设置选项
 | 
												
													
														
															|  |             for(WlyySurveyTemplateQuestionVO tq:tqVOs){
 |  |             for(WlyySurveyTemplateQuestionVO tq:tqVOs){
 | 
												
													
														
															|  |                 List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getId(),tq.getTemplateCode(),"1");
 |  | 
 | 
												
													
														
															|  | 
 |  |                 List<WlyySurveyTemplateOptionDO> optionDOs  = surveyTemplateOptionDao.findByQuestionCodeAndDelOrderBySortAsc(tq.getCode(),tq.getTemplateCode(),"1");
 | 
												
													
														
															|  |                 List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
 |  |                 List<WlyySurveyTemplateOptionVO> optionVOs = new ArrayList<>();
 | 
												
													
														
															|  |                 convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
 |  |                 convertToModels(optionDOs,optionVOs,WlyySurveyTemplateOptionVO.class);
 | 
												
													
														
															|  |                 int tpCount = 0;
 |  |                 int tpCount = 0;
 | 
												
													
														
															|  |                 List<WlyySurveyUserAnswerDO> answerQuestionDOs = surveyUserAnswerDao.findByTempQuestionCodeDistinctPatient(tq.getId(),tempId);
 |  | 
 | 
												
													
														
															|  | 
 |  |                 List<WlyySurveyUserAnswerDO> answerQuestionDOs = surveyUserAnswerDao.findByTempQuestionCodeDistinctPatient(tq.getCode(),tempId);
 | 
												
													
														
															|  |                 if(answerQuestionDOs!=null&&answerQuestionDOs.size()>0){
 |  |                 if(answerQuestionDOs!=null&&answerQuestionDOs.size()>0){
 | 
												
													
														
															|  |                     tpCount = answerQuestionDOs.size();
 |  |                     tpCount = answerQuestionDOs.size();
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
											
												
													
														
															|  | @ -711,17 +778,19 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |                 if(optionVOs!=null&&optionVOs.size()>0){
 |  |                 if(optionVOs!=null&&optionVOs.size()>0){
 | 
												
													
														
															|  |                     for(WlyySurveyTemplateOptionVO vo:optionVOs){
 |  |                     for(WlyySurveyTemplateOptionVO vo:optionVOs){
 | 
												
													
														
															|  |                         Integer answerCount =0;
 |  |                         Integer answerCount =0;
 | 
												
													
														
															|  |                         List<WlyySurveyUserAnswerDO> answerDOs = surveyUserAnswerDao.findBytempOptionCode(vo.getId(),vo.getTemplateCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         List<WlyySurveyUserAnswerDO> answerDOs = surveyUserAnswerDao.findBytempOptionCode(vo.getCode(),vo.getTemplateCode());
 | 
												
													
														
															|  |                         if(answerDOs!=null&&answerDOs.size()>0){
 |  |                         if(answerDOs!=null&&answerDOs.size()>0){
 | 
												
													
														
															|  |                             answerCount = answerDOs.size();
 |  |                             answerCount = answerDOs.size();
 | 
												
													
														
															|  |                         }
 |  |                         }
 | 
												
													
														
															|  |                         vo.setPercentage(PercentageUtil.bs(answerCount,total)+"%");
 |  |                         vo.setPercentage(PercentageUtil.bs(answerCount,total)+"%");
 | 
												
													
														
															|  |                         vo.setOptCount(answerCount);
 |  |                         vo.setOptCount(answerCount);
 | 
												
													
														
															|  | 
 |  |                         vo.setId(vo.getCode());
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 tq.setOptionVOs(optionVOs);
 |  |                 tq.setOptionVOs(optionVOs);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                 tq.setId(tq.getCode());
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  |             templateVO.setTemplateQuestionVOs(tqVOs);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return templateVO;
 |  |         return templateVO;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
											
												
													
														
															|  | @ -736,10 +805,10 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |      * @param size
 |  |      * @param size
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public MixEnvelop findQuestionInfoList(String comment, String content, String tempQuestionCode,String tempOptionCode,Integer page,Integer size){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public MixEnvelop findQuestionInfoList(String comment, String tempId,String content, String tempQuestionCode,String tempOptionCode,Integer page,Integer size){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String totalSql ="SELECT " +
 |  |         String totalSql ="SELECT " +
 | 
												
													
														
															|  |                 " COUNT(1) AS total" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " COUNT(1) AS \"total\"" +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_user_answer t " +
 |  |                 " wlyy_survey_user_answer t " +
 | 
												
													
														
															|  |                 " WHERE 1=1";
 |  |                 " WHERE 1=1";
 | 
												
											
												
													
														
															|  | @ -755,26 +824,29 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(tempOptionCode)){
 |  |         if(StringUtils.isNotBlank(tempOptionCode)){
 | 
												
													
														
															|  |             totalSql += " AND t.temp_option_code ='"+tempOptionCode+"'";
 |  |             totalSql += " AND t.temp_option_code ='"+tempOptionCode+"'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if(StringUtils.isNotBlank(tempId)){
 | 
												
													
														
															|  | 
 |  |             totalSql += " AND t.survey_temp_code ='"+tempId+"'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 | 
												
													
														
															|  |         Long count = 0L;
 |  |         Long count = 0L;
 | 
												
													
														
															|  |         if (rstotal != null && rstotal.size() > 0) {
 |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
												
													
														
															|  |             count = (Long) rstotal.get(0).get("total");
 |  | 
 | 
												
													
														
															|  | 
 |  |             count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sql = "SELECT " +
 |  |         String sql = "SELECT " +
 | 
												
													
														
															|  |                 " t.id, " +
 |  | 
 | 
												
													
														
															|  |                 " t.survey_temp_code AS surveyTempCode, " +
 |  | 
 | 
												
													
														
															|  |                 " t.temp_question_code AS tempQuestionCode, " +
 |  | 
 | 
												
													
														
															|  |                 " t.question_type AS questionType, " +
 |  | 
 | 
												
													
														
															|  |                 " t.temp_option_code AS tempOptionCode, " +
 |  | 
 | 
												
													
														
															|  |                 " t.comment, " +
 |  | 
 | 
												
													
														
															|  |                 " t.content, " +
 |  | 
 | 
												
													
														
															|  |                 " t.patient," +
 |  | 
 | 
												
													
														
															|  |                 " t.patient_name AS patientName," +
 |  | 
 | 
												
													
														
															|  |                 " t.score," +
 |  | 
 | 
												
													
														
															|  |                 " t.create_time AS createTime" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " t.id as \"id\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.survey_temp_code AS \"surveyTempCode\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.temp_question_code AS \"tempQuestionCode\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.question_type AS \"questionType\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.temp_option_code AS \"tempOptionCode\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.comment AS \"comment\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.content AS \"content\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.patient AS \"patient\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.patient_name AS \"patientName\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.score AS \"score\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.create_time AS \"createTime\"" +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_user_answer t " +
 |  |                 " wlyy_survey_user_answer t " +
 | 
												
													
														
															|  |                 " WHERE 1=1";
 |  |                 " WHERE 1=1";
 | 
												
											
												
													
														
															|  | @ -790,8 +862,26 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(tempOptionCode)){
 |  |         if(StringUtils.isNotBlank(tempOptionCode)){
 | 
												
													
														
															|  |             sql += " AND t.temp_option_code ='"+tempOptionCode+"'";
 |  |             sql += " AND t.temp_option_code ='"+tempOptionCode+"'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         sql += " ORDER BY t.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
 |  | 
 | 
												
													
														
															|  | 
 |  |         if(StringUtils.isNotBlank(tempId)){
 | 
												
													
														
															|  | 
 |  |             sql += " AND t.survey_temp_code ='"+tempId+"'";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         sql += " ORDER BY t.create_time DESC  ";
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (flag){
 | 
												
													
														
															|  | 
 |  |                 sql ="SELECT * FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "( SELECT A.*, ROWNUM RN FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "    ("+sql+") A \n" +
 | 
												
													
														
															|  | 
 |  |                         "    WHERE ROWNUM <= "+page*size+" ) \n" +
 | 
												
													
														
															|  | 
 |  |                         "       WHERE RN >= "+((page-1)*size+1);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             sql+="LIMIT "+ (page - 1) * size + "," + size + " ";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         List<WlyySurveyUserAnswerDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyUserAnswerDO.class));
 |  |         List<WlyySurveyUserAnswerDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyySurveyUserAnswerDO.class));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
 |  |         return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
 | 
												
											
												
													
														
															|  | @ -807,7 +897,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |     public MixEnvelop findAnswerList(String tempId,String patient,String patientName,String title,Integer page,Integer size){
 |  |     public MixEnvelop findAnswerList(String tempId,String patient,String patientName,String title,Integer page,Integer size){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String totalSql ="SELECT " +
 |  |         String totalSql ="SELECT " +
 | 
												
													
														
															|  |                 " COUNT(1) AS total" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " COUNT(1) AS \"total\"" +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_user t " +
 |  |                 " wlyy_survey_user t " +
 | 
												
													
														
															|  |                 " WHERE 1=1 and t.status = 1 ";
 |  |                 " WHERE 1=1 and t.status = 1 ";
 | 
												
											
												
													
														
															|  | @ -827,24 +917,24 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 | 
												
													
														
															|  |         Long count = 0L;
 |  |         Long count = 0L;
 | 
												
													
														
															|  |         if (rstotal != null && rstotal.size() > 0) {
 |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
												
													
														
															|  |             count = (Long) rstotal.get(0).get("total");
 |  | 
 | 
												
													
														
															|  | 
 |  |             count = hibenateUtils.objTransformLong(rstotal.get(0).get("total"));
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String sql = "SELECT " +
 |  |         String sql = "SELECT " +
 | 
												
													
														
															|  |                 " t.id, " +
 |  | 
 | 
												
													
														
															|  |                 " t.survey_temp_code AS surveyTempCode, " +
 |  | 
 | 
												
													
														
															|  |                 " t.survey_temp_title AS surveyTempTitle, " +
 |  | 
 | 
												
													
														
															|  |                 " t.patient," +
 |  | 
 | 
												
													
														
															|  |                 " t.patient_name AS patientName," +
 |  | 
 | 
												
													
														
															|  |                 " t.dept," +
 |  | 
 | 
												
													
														
															|  |                 " t.dept_name AS deptName," +
 |  | 
 | 
												
													
														
															|  |                 " t.doctor," +
 |  | 
 | 
												
													
														
															|  |                 " t.doctor_name AS doctorName," +
 |  | 
 | 
												
													
														
															|  |                 " t.status," +
 |  | 
 | 
												
													
														
															|  |                 " t.end_time AS endTime," +
 |  | 
 | 
												
													
														
															|  |                 " t.create_time AS createTime," +
 |  | 
 | 
												
													
														
															|  |                 " p.idcard," +
 |  | 
 | 
												
													
														
															|  |                 " p.sex" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " t.id as \"id\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.survey_temp_code AS \"surveyTempCode\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.survey_temp_title AS \"surveyTempTitle\", " +
 | 
												
													
														
															|  | 
 |  |                 " t.patient as \"patient\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.patient_name AS \"patientName\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.dept as \"dept\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.dept_name AS \"deptName\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.doctor AS \"doctor\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.doctor_name AS \"doctorName\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.status AS \"status\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.end_time AS \"endTime\"," +
 | 
												
													
														
															|  | 
 |  |                 " t.create_time AS \"createTime\"," +
 | 
												
													
														
															|  | 
 |  |                 " p.idcard as \"idcard\"," +
 | 
												
													
														
															|  | 
 |  |                 " p.sex as \"sex\"" +
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_survey_user t " +
 |  |                 " wlyy_survey_user t " +
 | 
												
													
														
															|  |                 " JOIN base_patient p ON t.patient = p.id " +
 |  |                 " JOIN base_patient p ON t.patient = p.id " +
 | 
												
											
												
													
														
															|  | @ -904,4 +994,5 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
 | 
												
													
														
															|  |         String response = HttpClientUtil.postBody(imAddr, params);
 |  |         String response = HttpClientUtil.postBody(imAddr, params);
 | 
												
													
														
															|  |         return response;
 |  |         return response;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |