|
@ -18,6 +18,7 @@ import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.jdbc.support.nativejdbc.OracleJdbc4NativeJdbcExtractor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@ -52,6 +53,12 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
|
|
|
private SurveyLabelInfoDao surveyLabelInfoDao;
|
|
|
@Autowired
|
|
|
private SurveyInspLabelInfoDao surveyInspLabelInfoDao;
|
|
|
@Autowired
|
|
|
private SurveyDeptDao surveyDeptDao;
|
|
|
@Autowired
|
|
|
private SurveyUserDao surveyUserDao;
|
|
|
@Autowired
|
|
|
private SurveyUserAnswerDao surveyUserAnswerDao;
|
|
|
/**
|
|
|
* 查询字典
|
|
|
* 1.surveyLabel;2.surveyScreenLabel
|
|
@ -414,4 +421,97 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
//=======================调查问卷发送=====================
|
|
|
|
|
|
/**
|
|
|
* 保存问卷科室关系
|
|
|
* @param tempId
|
|
|
* @param sdJsons
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Boolean saveSurveyDept(String tempId,String sdJsons)throws Exception{
|
|
|
|
|
|
//删除之前关系
|
|
|
List<WlyySurveyDeptDO> dels = surveyDeptDao.findBySurveyTempCode(tempId);
|
|
|
if(dels!=null&&dels.size()>0){
|
|
|
surveyDeptDao.delete(dels);
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(sdJsons)){
|
|
|
List<WlyySurveyDeptDO> list = EntityUtils.jsonToList(sdJsons,WlyySurveyDeptDO.class);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
surveyDeptDao.save(list);
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询科室下问卷列表
|
|
|
* @param dept
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findSurveyByDept(String dept){
|
|
|
String sql = "SELECT " +
|
|
|
" t.id, " +
|
|
|
" t.title, " +
|
|
|
" t.template_comment AS templateComment " +
|
|
|
" FROM " +
|
|
|
" wlyy_survey_template t " +
|
|
|
" JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
|
|
|
" WHERE " +
|
|
|
" d.dept = '"+dept+"'";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询问卷下科室
|
|
|
* @param tempId
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findDeptBySurvey(String tempId){
|
|
|
String sql ="SELECT " +
|
|
|
" d.dept, " +
|
|
|
" d.dept_name AS deptName " +
|
|
|
" FROM " +
|
|
|
" wlyy_survey_template t " +
|
|
|
" JOIN wlyy_survey_dept d ON t.id = d.survey_temp_code " +
|
|
|
" WHERE " +
|
|
|
" t.id = '"+tempId+"'";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param suJson
|
|
|
* @param suaJsons
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Boolean saveSurveyAnswer(String suJson,String suaJsons)throws Exception{
|
|
|
|
|
|
WlyySurveyUserDO surveyUserDO = objectMapper.readValue(suJson,WlyySurveyUserDO.class);
|
|
|
surveyUserDao.save(surveyUserDO);
|
|
|
|
|
|
//删除问题答案
|
|
|
List<WlyySurveyUserAnswerDO> dels = surveyUserAnswerDao.findBySurveyTempCodeAndPatient(surveyUserDO.getSurveyTempCode(),surveyUserDO.getPatient());
|
|
|
if(dels!=null&&dels.size()>0){
|
|
|
surveyUserAnswerDao.delete(dels);
|
|
|
}
|
|
|
|
|
|
//保存答案
|
|
|
if(StringUtils.isNotBlank(suaJsons)){
|
|
|
List<WlyySurveyUserAnswerDO> answerDOs = EntityUtils.jsonToList(suaJsons,WlyySurveyUserAnswerDO.class);
|
|
|
surveyUserAnswerDao.save(answerDOs);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public List<WlyySurveyUserAnswerDO> findAnswerBySurveyTempCode(String patient,String tempId){
|
|
|
List<WlyySurveyUserAnswerDO> list = surveyUserAnswerDao.findBySurveyTempCodeAndPatient(tempId,patient);
|
|
|
return list;
|
|
|
}
|
|
|
}
|