|
@ -2,11 +2,11 @@ package com.yihu.wlyy.service.synergy;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.yihu.wlyy.entity.survey.SurveyQuestionResult;
|
|
import com.yihu.wlyy.entity.survey.SurveyQuestionResult;
|
|
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestions;
|
|
|
|
|
|
import com.yihu.wlyy.entity.survey.SurveyQuestionnaire;
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
|
|
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
|
|
import com.yihu.wlyy.repository.survey.SurveyQuestionResultDao;
|
|
import com.yihu.wlyy.repository.survey.SurveyQuestionResultDao;
|
|
import com.yihu.wlyy.repository.survey.SurveyTemplateQuestionsDao;
|
|
|
|
|
|
import com.yihu.wlyy.repository.survey.SurveyQuestionnaireDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
|
|
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
@ -38,7 +38,7 @@ public class QuestionnaireManageService extends BaseJpaService {
|
|
@Autowired
|
|
@Autowired
|
|
private ManageSynergyWorkorderServicerDao workorderServicerDao;
|
|
private ManageSynergyWorkorderServicerDao workorderServicerDao;
|
|
@Autowired
|
|
@Autowired
|
|
private SurveyTemplateQuestionsDao templateQuestionDao;
|
|
|
|
|
|
private SurveyQuestionnaireDao surveyQuestionnaireDao;
|
|
@Autowired
|
|
@Autowired
|
|
private SurveyQuestionResultDao questionResultDao;
|
|
private SurveyQuestionResultDao questionResultDao;
|
|
@Autowired
|
|
@Autowired
|
|
@ -122,14 +122,14 @@ public class QuestionnaireManageService extends BaseJpaService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查看调查问卷统计结果
|
|
* 查看调查问卷统计结果
|
|
* @param templateCode
|
|
|
|
|
|
* @param surveyCode
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject getAnswers(String templateCode) {
|
|
|
|
String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?id=" + templateCode;
|
|
|
|
|
|
public JSONObject getAnswers(String surveyCode) {
|
|
|
|
String url = wlyyUrl + "third/synergy/questionnaire/getAnswers?id=" + surveyCode;
|
|
String response = httpClientUtil.get(url, "UTF-8");
|
|
String response = httpClientUtil.get(url, "UTF-8");
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
if(jsonObject.getString("msg").equals("查询成功!")){
|
|
|
|
|
|
if(jsonObject.getInteger("status") == 200){
|
|
return JSONObject.parseObject(jsonObject.getString("data"));
|
|
return JSONObject.parseObject(jsonObject.getString("data"));
|
|
}
|
|
}
|
|
return JSONObject.parseObject(response);
|
|
return JSONObject.parseObject(response);
|
|
@ -147,21 +147,21 @@ public class QuestionnaireManageService extends BaseJpaService {
|
|
String patient = questionResult.getPatientCode();
|
|
String patient = questionResult.getPatientCode();
|
|
String templateCode = questionResult.getTemplateCode();
|
|
String templateCode = questionResult.getTemplateCode();
|
|
//获取模板问题
|
|
//获取模板问题
|
|
List<SurveyTemplateQuestions> questionList = templateQuestionDao.findByTemplateCode(templateCode);
|
|
|
|
|
|
List<SurveyQuestionnaire> questionList = surveyQuestionnaireDao.findBySurveyCode(templateCode);
|
|
//查找选项和答案
|
|
//查找选项和答案
|
|
Map<String, Object> answerMap = new HashMap<>();
|
|
Map<String, Object> answerMap = new HashMap<>();
|
|
String sql = "SELECT soa.*, sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
|
|
|
|
|
|
String sql = "SELECT soa.*, sqo.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_questions_options sqo ON soa.options_code= sqo.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
|
|
List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patient, templateCode});
|
|
List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patient, templateCode});
|
|
for (SurveyTemplateQuestions templateQuestion : questionList) {
|
|
|
|
|
|
for (SurveyQuestionnaire question : questionList) {
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
map.put("question", templateQuestion);
|
|
|
|
String qusCode = templateQuestion.getCode();
|
|
|
|
|
|
map.put("question", question);
|
|
|
|
String qusCode = question.getCode();
|
|
for (Map<String, Object> option : optionAnswersList) {
|
|
for (Map<String, Object> option : optionAnswersList) {
|
|
if (option.get("question_code").equals(qusCode)) {
|
|
if (option.get("question_code").equals(qusCode)) {
|
|
map.put("option", option);
|
|
map.put("option", option);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
answerMap.put(templateQuestion.getSort() + "", map);
|
|
|
|
|
|
answerMap.put(question.getSort() + "", map);
|
|
}
|
|
}
|
|
json.put("answer", answerMap);
|
|
json.put("answer", answerMap);
|
|
return json;
|
|
return json;
|
|
@ -171,7 +171,7 @@ public class QuestionnaireManageService extends BaseJpaService {
|
|
String url = wlyyUrl + "third/synergy/questionnaire/getQuestionnaireDetail?id=" + surveyCode;
|
|
String url = wlyyUrl + "third/synergy/questionnaire/getQuestionnaireDetail?id=" + surveyCode;
|
|
String response = httpClientUtil.get(url, "UTF-8");
|
|
String response = httpClientUtil.get(url, "UTF-8");
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
if(jsonObject.getString("msg").equals("查询成功")){
|
|
|
|
|
|
if(jsonObject.getInteger("status") == 200){
|
|
return JSONObject.parseObject(jsonObject.getString("data"));
|
|
return JSONObject.parseObject(jsonObject.getString("data"));
|
|
}
|
|
}
|
|
return JSONObject.parseObject(response);
|
|
return JSONObject.parseObject(response);
|