|
@ -139,23 +139,49 @@ public class SpecialistScreenResultService {
|
|
|
List<SurveyTemplateQuestionsVo> questionList = jdbcTemplate.query(questionSql,new BeanPropertyRowMapper<>(SurveyTemplateQuestionsVo.class));
|
|
|
String sql = "SELECT soa.*,sto.score,sto.content FROM "+basedb+".wlyy_survey_option_answers soa LEFT JOIN "+basedb+".wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
|
|
|
List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
|
|
|
//问答题答案
|
|
|
String sqlQuestion = "SELECT sa.* FROM "+basedb+".wlyy_survey_answers sa LEFT JOIN "+basedb+".wlyy_survey_template_questions stq ON sa.question_code = stq.`code` WHERE sa.question_result_code=? AND sa.patient=? AND sa.survey_code=? ";
|
|
|
List<Map<String, Object>> questionAnswersList = jdbcTemplate.queryForList(sqlQuestion, new Object[]{code, patientCode, templateCode});
|
|
|
|
|
|
for (SurveyTemplateQuestionsVo surveyTemplateQuestionsVo : questionList){
|
|
|
Map<String,Object> Qusmap = new HashMap<>();
|
|
|
Qusmap.put("question",surveyTemplateQuestionsVo);
|
|
|
String qusCode = surveyTemplateQuestionsVo.getCode();
|
|
|
for (Map<String,Object> option : optionAnswersList){
|
|
|
/*for (Map<String,Object> option : optionAnswersList){
|
|
|
if (option.get("question_code").equals(qusCode)){
|
|
|
Qusmap.put("option",option);
|
|
|
}
|
|
|
}*/
|
|
|
if(surveyTemplateQuestionsVo.getQuestionType() == 2){//问答题答案放在wlyy_survey_answers
|
|
|
for (Map<String, Object> question : questionAnswersList) {
|
|
|
if (question.get("question_code").equals(qusCode)) {
|
|
|
Qusmap.put("option", question);
|
|
|
}
|
|
|
}
|
|
|
}else if(surveyTemplateQuestionsVo.getQuestionType() == 0){
|
|
|
for (Map<String, Object> option : optionAnswersList) {
|
|
|
if (option.get("question_code").equals(qusCode)) {
|
|
|
Qusmap.put("option", option);
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
List<Map<String, Object>> options = new ArrayList<>();
|
|
|
for (Map<String, Object> option : optionAnswersList) {
|
|
|
if (option.get("question_code").equals(qusCode)) {
|
|
|
options.add(option);
|
|
|
}
|
|
|
}
|
|
|
Qusmap.put("option", options);
|
|
|
}
|
|
|
//map.put(surveyTemplateQuestionsVo.getSort()+"",Qusmap);
|
|
|
answerMap.put(surveyTemplateQuestionsVo.getSort()+"",Qusmap);
|
|
|
}
|
|
|
map.put("answer",answerMap);
|
|
|
//结果
|
|
|
int following = surveyScreenResultVo.getFollowing();
|
|
|
String reultSql ="SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM "+basedb+".wlyy_survey_screen_result ssr LEFT JOIN "+basedb+".wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='"+code+"'";
|
|
|
Map<String,Object> resultMap = jdbcTemplate.queryForMap(reultSql);
|
|
|
String reultSql = "SELECT ssr.screen_result_score,ssr.screen_result,str.advice,ssr.other_advice,ssr.third_advice FROM " + basedb + ".wlyy_survey_screen_result ssr LEFT JOIN " + basedb + ".wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='" + code + "'";
|
|
|
Map<String, Object> resultMap = jdbcTemplate.queryForMap(reultSql);
|
|
|
if(surveyScreenResultVo.getFollowing() != null) {
|
|
|
int following = surveyScreenResultVo.getFollowing();
|
|
|
/*int following = surveyScreenResultVo.getFollowing();
|
|
|
int order = surveyScreenResultVo.getOrder();
|
|
|
if (following==1){
|
|
@ -169,20 +195,21 @@ public class SpecialistScreenResultService {
|
|
|
}
|
|
|
resultMap.put("advice",surveyAdviceList);
|
|
|
}*/
|
|
|
if (following==1){
|
|
|
String adviceCodes = surveyScreenResultVo.getAdviceCode();
|
|
|
List<Map<String,Object>> surveyAdviceList = new ArrayList<>();
|
|
|
if (StringUtils.isNotEmpty(adviceCodes)){
|
|
|
String[] advicesStr = adviceCodes.split(",");
|
|
|
for (String adviceCode : advicesStr){
|
|
|
String advice ="SELECT * FROM wlyy.wlyy_survey_advice where code='"+adviceCode+"'";
|
|
|
surveyAdviceList.addAll(jdbcTemplate.queryForList(advice));
|
|
|
if (following == 1) {
|
|
|
String adviceCodes = surveyScreenResultVo.getAdviceCode();
|
|
|
List<Map<String, Object>> surveyAdviceList = new ArrayList<>();
|
|
|
if (StringUtils.isNotEmpty(adviceCodes)) {
|
|
|
String[] advicesStr = adviceCodes.split(",");
|
|
|
for (String adviceCode : advicesStr) {
|
|
|
String advice = "SELECT * FROM wlyy.wlyy_survey_advice where code='" + adviceCode + "'";
|
|
|
surveyAdviceList.addAll(jdbcTemplate.queryForList(advice));
|
|
|
}
|
|
|
}
|
|
|
resultMap.put("doctorAdvice", surveyAdviceList);
|
|
|
resultMap.put("doctorOtherAdvice", surveyScreenResultVo.getOtherAdvice());
|
|
|
}
|
|
|
resultMap.put("doctorAdvice",surveyAdviceList);
|
|
|
resultMap.put("doctorOtherAdvice",surveyScreenResultVo.getOtherAdvice());
|
|
|
}
|
|
|
map.put("result",resultMap);
|
|
|
map.put("result", resultMap);
|
|
|
return MixEnvelop.getSuccess(SpecialistMapping.api_success,map);
|
|
|
}
|
|
|
|