|  | @ -47,11 +47,15 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private SurveyTemplateQuestionsDao surveyTemplateQuestionsDao;
 |  |     private SurveyTemplateQuestionsDao surveyTemplateQuestionsDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private SurveyOptionAnswersDao surveyOptionAnswersDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  |     private DoctorDao doctorDao;
 |  |     private DoctorDao doctorDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private SurveyAdviceDao surveyAdviceDao;
 |  |     private SurveyAdviceDao surveyAdviceDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private SignFamilyDao signFamilyDao;
 |  |     private SignFamilyDao signFamilyDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private ManagerQuestionnaireService managerQuestionnaireService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     private Logger logger = LoggerFactory.getLogger(this.getClass());
 |  |     private Logger logger = LoggerFactory.getLogger(this.getClass());
 | 
												
											
												
													
														
															|  | @ -117,7 +121,7 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType){
 |  |     public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType){
 | 
												
													
														
															|  |         int start = (pageNo-1)*pageSize;
 |  |         int start = (pageNo-1)*pageSize;
 | 
												
													
														
															|  |         String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code WHERE st.del = 1 and sli.label="+labelType+" limit "+start+","+pageSize;
 |  | 
 | 
												
													
														
															|  | 
 |  |         String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code WHERE st.del = 1 and sli.label="+labelType+" order by st.create_time desc limit "+start+","+pageSize;
 | 
												
													
														
															|  |         List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyTemplates.class));
 |  |         List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyTemplates.class));
 | 
												
													
														
															|  |         return surveyTemplatesList;
 |  |         return surveyTemplatesList;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
											
												
													
														
															|  | @ -129,7 +133,7 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |      * @param source
 |  |      * @param source
 | 
												
													
														
															|  |      * @param jsonData
 |  |      * @param jsonData
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public String saveScreenResult(String patientCode,String doctor,int isAgain,int source, JSONObject jsonData){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public String saveScreenResultAndAnswer(String patientCode,String doctor,int isAgain,int source, JSONObject jsonData)throws Exception{
 | 
												
													
														
															|  |         System.out.println("********保存筛查结果--jsonData********* " + jsonData);
 |  |         System.out.println("********保存筛查结果--jsonData********* " + jsonData);
 | 
												
													
														
															|  |         String surveyCode = jsonData.get("surveyCode").toString();
 |  |         String surveyCode = jsonData.get("surveyCode").toString();
 | 
												
													
														
															|  |         SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
 |  |         SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
 | 
												
											
												
													
														
															|  | @ -138,6 +142,7 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |         //解析json保存各种答案--获取一维数组
 |  |         //解析json保存各种答案--获取一维数组
 | 
												
													
														
															|  |         JSONArray questions = jsonData.getJSONArray("questions");
 |  |         JSONArray questions = jsonData.getJSONArray("questions");
 | 
												
													
														
															|  |         int totalScore = 0;
 |  |         int totalScore = 0;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         for (int i = 0; i < questions.length(); i++) {
 |  |         for (int i = 0; i < questions.length(); i++) {
 | 
												
													
														
															|  |             //获取每一道题的信息
 |  |             //获取每一道题的信息
 | 
												
													
														
															|  |             JSONObject question = new JSONObject(questions.get(i).toString());
 |  |             JSONObject question = new JSONObject(questions.get(i).toString());
 | 
												
											
												
													
														
															|  | @ -148,7 +153,20 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |                     JSONArray options = question.getJSONArray("options");
 |  |                     JSONArray options = question.getJSONArray("options");
 | 
												
													
														
															|  |                     for (int j = 0; j < options.length(); j++) {
 |  |                     for (int j = 0; j < options.length(); j++) {
 | 
												
													
														
															|  |                         JSONObject option = new JSONObject(options.get(j).toString());
 |  |                         JSONObject option = new JSONObject(options.get(j).toString());
 | 
												
													
														
															|  |                         int score = Integer.parseInt(option.getString("score"));
 |  | 
 | 
												
													
														
															|  | 
 |  |                         /*String code = getCode();
 | 
												
													
														
															|  | 
 |  |                         String optionCode = option.get("optionCode").toString();
 | 
												
													
														
															|  | 
 |  |                         String comment = null;
 | 
												
													
														
															|  | 
 |  |                         int haveComment = 0;
 | 
												
													
														
															|  | 
 |  |                         if (option.has("comment")) {
 | 
												
													
														
															|  | 
 |  |                             comment = option.get("comment").toString();
 | 
												
													
														
															|  | 
 |  |                             haveComment = 1;
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  | 
 |  |                         //保存到选择题答案表
 | 
												
													
														
															|  | 
 |  |                         SurveyOptionAnswers optionAnswer = new SurveyOptionAnswers(code, patientCode, surveyCode, qstCode, optionCode, comment, type, createTime,patient.getOpenid());
 | 
												
													
														
															|  | 
 |  |                         surveyOptionAnswersDao.save(optionAnswer);
 | 
												
													
														
															|  | 
 |  |                         //选择题修改统计表数量
 | 
												
													
														
															|  | 
 |  |                         surveyStatisticsDao.modifyAmount(surveyCode, qstCode, optionCode);*/
 | 
												
													
														
															|  | 
 |  |                         int score = option.getInt("score");
 | 
												
													
														
															|  |                         totalScore += score;
 |  |                         totalScore += score;
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
											
												
													
														
															|  | @ -204,6 +222,7 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |         surveyScreenResult.setOver(1);
 |  |         surveyScreenResult.setOver(1);
 | 
												
													
														
															|  |         surveyScreenResult.setCzrq(new Date());
 |  |         surveyScreenResult.setCzrq(new Date());
 | 
												
													
														
															|  |         surveyScreenResult.setIsAgain(1);
 |  |         surveyScreenResult.setIsAgain(1);
 | 
												
													
														
															|  | 
 |  |         surveyScreenResult.setIsEducate(0);
 | 
												
													
														
															|  |         surveyScreenResult.setScreenResultScore(totalScore);
 |  |         surveyScreenResult.setScreenResultScore(totalScore);
 | 
												
													
														
															|  |         if (surveyTemplateResult!=null){
 |  |         if (surveyTemplateResult!=null){
 | 
												
													
														
															|  |             surveyScreenResult.setScreenResultCode(surveyTemplateResult.getCode());
 |  |             surveyScreenResult.setScreenResultCode(surveyTemplateResult.getCode());
 | 
												
											
												
													
														
															|  | @ -211,8 +230,8 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |             surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
 |  |             surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         surveyScreenResultDao.save(surveyScreenResult);
 |  |         surveyScreenResultDao.save(surveyScreenResult);
 | 
												
													
														
															|  | 
 |  |         managerQuestionnaireService.saveAnswer(patientCode,code,jsonData);
 | 
												
													
														
															|  |         return code;
 |  |         return code;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONObject getScreenResultDetail(String code)throws Exception{
 |  |     public JSONObject getScreenResultDetail(String code)throws Exception{
 | 
												
											
												
													
														
															|  | @ -321,6 +340,10 @@ public class SurveyScreenResultService extends BaseService {
 | 
												
													
														
															|  |             mapList.add(sMap);
 |  |             mapList.add(sMap);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         map.put("screenList",mapList);
 |  |         map.put("screenList",mapList);
 | 
												
													
														
															|  | 
 |  |         return map;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  |     public Map<String,Object> patientGetResult(String patientCode){
 | 
												
													
														
															|  | 
 |  |         Map<String,Object> map = new HashedMap();
 | 
												
													
														
															|  |         String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE patient_code='"+patientCode+"' ORDER BY czrq DESC) a  GROUP BY a.template_code";
 |  |         String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE patient_code='"+patientCode+"' ORDER BY czrq DESC) a  GROUP BY a.template_code";
 | 
												
													
														
															|  |         List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
 |  |         List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
 | 
												
													
														
															|  |         map.put("result",surveyScreenResultList);
 |  |         map.put("result",surveyScreenResultList);
 |