|
@ -116,12 +116,7 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
JSONArray disease = surveyTarget.getJSONArray("disease");
|
|
|
JSONArray service = surveyTarget.getJSONArray("service");
|
|
|
JSONArray healthCondition = surveyTarget.getJSONArray("healthCondition");
|
|
|
/*String str = "SELECT DISTINCT t.patient " +
|
|
|
"FROM `wlyy_sign_patient_label_info` t,wlyy_patient p,`wlyy_sign_family` f " +
|
|
|
"WHERE t.`patient` = p.`code` AND f.`patient`=t.`patient` AND f.`status` IN (1,2,3) AND p.`openid` IS NOT NULL AND p.`openid`!='' ";*/
|
|
|
// 保存到维度详情表(不限不保存) 维度表(1性别 2疾病类型 3服务类型 4健康状况)
|
|
|
if (sex != 0) {
|
|
|
// str += "AND(p.sex=" + sex + ")";
|
|
|
String dimensionCode = surveyDimensionDao.findByName("性别");
|
|
|
String dimensionDetailCode = getCode();
|
|
|
SurveyDimensionDetail surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, sex == 1 ? "男" : "女", sex, "性别", 1, surveyCode);
|
|
@ -130,15 +125,11 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
SurveyFilter surveyFilter = new SurveyFilter(getCode(), surveyCode, dimensionDetailCode);
|
|
|
surveyFilterDao.save(surveyFilter);
|
|
|
}
|
|
|
// String ser = "";
|
|
|
// String servi = "";
|
|
|
for (Object serv : service) {
|
|
|
if ("0".equals(serv.toString())) {
|
|
|
// ser += ",";
|
|
|
break;
|
|
|
} else {
|
|
|
// ser += serv.toString() + ",";
|
|
|
// ===================================
|
|
|
// ===================================
|
|
|
String dimensionCode = surveyDimensionDao.findByName("服务类型");
|
|
|
String dimensionDetailCode = getCode();
|
|
|
SurveyDimensionDetail surveyDimensionDetail = null;
|
|
@ -161,18 +152,10 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
surveyFilterDao.save(surveyFilter);
|
|
|
}
|
|
|
}
|
|
|
/*ser = ser.substring(0, ser.length() - 1);
|
|
|
if (ser.length() != 0) {
|
|
|
servi = "(t.`label_type`=1 AND t.`label`IN(" + ser + "))";
|
|
|
}*/
|
|
|
// String heal = "";
|
|
|
// String healt = "";
|
|
|
for (Object health : healthCondition) {
|
|
|
if ("0".equals(health.toString())) {
|
|
|
// heal += ",";
|
|
|
break;
|
|
|
} else {
|
|
|
// heal += health.toString() + ",";
|
|
|
String dimensionCode = surveyDimensionDao.findByName("健康状况");
|
|
|
String dimensionDetailCode = getCode();
|
|
|
String surveyFilterCode = getCode();
|
|
@ -199,19 +182,11 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
/* heal = heal.substring(0, heal.length() - 1);
|
|
|
if (heal.length() != 0) {
|
|
|
healt = "(t.`label_type`=2 AND t.`label`IN(" + heal + "))";
|
|
|
}*/
|
|
|
// String dise = "";
|
|
|
// String diseas = "";
|
|
|
for (Object disea : disease) {
|
|
|
if ("0".equals(disea.toString())) {
|
|
|
// dise += ",";
|
|
|
break;
|
|
|
} else {
|
|
|
// dise += disea.toString() + ",";
|
|
|
// ================================================================
|
|
|
String dimensionCode = surveyDimensionDao.findByName("疾病类型");
|
|
|
String dimensionDetailCode = getCode();
|
|
|
SurveyDimensionDetail surveyDimensionDetail = null;
|
|
@ -230,34 +205,6 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
surveyFilterDao.save(surveyFilter);
|
|
|
}
|
|
|
}
|
|
|
/*dise = dise.substring(0, dise.length() - 1);
|
|
|
if (dise.length() != 0) {
|
|
|
diseas = "(t.`label_type`=3 AND t.`label`IN(" + dise + "))";
|
|
|
}
|
|
|
if (servi.length() != 0 & healt.length() != 0 & diseas.length() != 0) {
|
|
|
str += " AND ( " + servi + " OR " + healt + " OR " + diseas + " )";
|
|
|
} else if (servi.length() != 0 & healt.length() != 0 & diseas.length() == 0) {
|
|
|
str += " AND ( " + servi + " OR " + healt + " )";
|
|
|
} else if (servi.length() != 0 & healt.length() == 0 & diseas.length() != 0) {
|
|
|
str += " AND ( " + servi + " OR " + diseas + " )";
|
|
|
} else if (servi.length() == 0 & healt.length() != 0 & diseas.length() != 0) {
|
|
|
str += " AND ( " + healt + " OR " + diseas + " )";
|
|
|
} else if (servi.length() != 0 & healt.length() == 0 & diseas.length() == 0) {
|
|
|
str += " AND " + servi;
|
|
|
} else if (servi.length() == 0 & healt.length() != 0 & diseas.length() == 0) {
|
|
|
str += " AND " + healt;
|
|
|
} else if (servi.length() == 0 & healt.length() == 0 & diseas.length() != 0) {
|
|
|
str += " AND " + diseas;
|
|
|
}*/
|
|
|
/* System.out.println("*****************str***********************" + str);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
sdf.format(new Date());
|
|
|
String jsonData = "{\"remark\":\"我们将按调查最终结果,优化健康服务。\",\"keyword1\":\"调查问卷\"}";
|
|
|
JSONObject json = new JSONObject(jsonData);
|
|
|
json.put("survey_id", surveyCode);*/
|
|
|
// List<Map<String, Object>> patients = jdbcTemplate.queryForList(str);
|
|
|
// Map<String, Object> map = jdbcTemplate.queryForMap(str);
|
|
|
// List<String> codes = jdbcTemplate.queryForList(str, String.class);
|
|
|
List<String> codes = getCount(surveyTarget.toString());
|
|
|
int amount = codes.size();
|
|
|
for (String code : codes) {
|
|
@ -266,7 +213,6 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
surveyUserDao.save(user);
|
|
|
}
|
|
|
// 发送居民模板 send=1发送
|
|
|
// ====================================================
|
|
|
if ("1".equals(send)) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String str = "{\"remark\":\"我们将按调查最终结果,优化健康服务。\",\"keyword1\":\"调查问卷\"}";
|
|
@ -343,8 +289,6 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}.start();
|
|
|
|
|
|
|
|
|
}
|
|
|
// =====================================================
|
|
|
// 获取标签数组
|
|
@ -397,7 +341,6 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
surveyQuestionnaire.setQuestionCodeNext(qstNextQuestion);
|
|
|
|
|
|
surveyQuestionnaireDao.save(surveyQuestionnaire);
|
|
|
System.out.println("=====================================");
|
|
|
// =======================选项保存=========================
|
|
|
// 选择题
|
|
|
JSONArray options = new JSONArray(tempQestion.get("options").toString());
|
|
@ -436,7 +379,6 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
SurveyStatistics statistics = new SurveyStatistics(statisticsCode, surveyCode, questionnaireCode, questionTitle, optionCode, 0, optcontent, haveComment, type, sort, optionSort);
|
|
|
surveyStatisticsDao.save(statistics);
|
|
|
}
|
|
|
// ===============================================================
|
|
|
break;
|
|
|
case 1:
|
|
|
// 多选特有属性
|
|
@ -1379,6 +1321,7 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
}
|
|
|
if (qstType != 2) {
|
|
|
List<SurveyQuestionnaireOptions> surveyQuestionnaireOptions = surveyQuestionnaireOptionsDao.findByIdAndQstCode(code, question.getCode());
|
|
|
// 问卷的选项编码都是新增的,不是从模板里复用的
|
|
|
for (SurveyQuestionnaireOptions option : surveyQuestionnaireOptions) {
|
|
|
// 更改到模板选项表 survey_template_options
|
|
|
String optCode = option.getCode();
|
|
@ -1387,8 +1330,7 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
String nextCode = option.getQuestionCodeNext();
|
|
|
Integer required = option.getIsRequired();
|
|
|
Integer optsort = option.getSort();
|
|
|
int row = surveyTemplateOptionsDao.modifyOption(templateCode, qstCode, optCode,
|
|
|
have, content, nextCode, required, optsort);
|
|
|
int row = surveyTemplateOptionsDao.modifyOption(templateCode, qstCode, optCode, have, content, nextCode, required, optsort);
|
|
|
// 新增问题的选项直接保存
|
|
|
if (row == 0) {
|
|
|
Integer del = option.getDel();
|