|
@ -109,11 +109,11 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
JSONArray healthCondition = surveyTarget.getJSONArray("healthCondition");
|
|
|
|
|
|
int sexList = 0;
|
|
|
for (Object se :sex) {
|
|
|
for (Object se : sex) {
|
|
|
JSONObject sexJson = new JSONObject(se.toString());
|
|
|
int label = sexJson.getInt("label");
|
|
|
sexList = label;
|
|
|
if (label!= 0) {
|
|
|
if (label != 0) {
|
|
|
String dimensionCode = surveyDimensionDao.findByName("性别");
|
|
|
String dimensionDetailCode = getCode();
|
|
|
// SurveyDimensionDetail surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, sex == 1 ? "男" : "女", sex, "性别", 1, surveyCode);
|
|
@ -131,7 +131,7 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
JSONObject servJson = new JSONObject(serv.toString());
|
|
|
int label = servJson.getInt("label");
|
|
|
servList.add(label);
|
|
|
if (label ==0) {
|
|
|
if (label == 0) {
|
|
|
break;
|
|
|
} else {
|
|
|
// ===================================
|
|
@ -164,14 +164,14 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
JSONObject healthJson = new JSONObject(health.toString());
|
|
|
int label = healthJson.getInt("label");
|
|
|
healthList.add(label);
|
|
|
if (label ==0) {
|
|
|
if (label == 0) {
|
|
|
break;
|
|
|
} else {
|
|
|
String dimensionCode = surveyDimensionDao.findByName("健康状况");
|
|
|
String dimensionDetailCode = getCode();
|
|
|
String surveyFilterCode = getCode();
|
|
|
SurveyDimensionDetail surveyDimensionDetail = null;
|
|
|
surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode,healthJson.getString("labelName") , label, "健康状况", 4, surveyCode);
|
|
|
surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, healthJson.getString("labelName"), label, "健康状况", 4, surveyCode);
|
|
|
|
|
|
/*switch (Integer.parseInt(health.toString())) {
|
|
|
// 1.健康人群 2.患病人群 3.高危人群 4.恢复期人群
|
|
@ -201,14 +201,14 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
JSONObject diseaJson = new JSONObject(disea.toString());
|
|
|
int label = diseaJson.getInt("label");
|
|
|
diseaList.add(label);
|
|
|
if (label ==0) {
|
|
|
if (label == 0) {
|
|
|
// dise += ",";
|
|
|
break;
|
|
|
} else {
|
|
|
String dimensionCode = surveyDimensionDao.findByName("疾病类型");
|
|
|
String dimensionDetailCode = getCode();
|
|
|
SurveyDimensionDetail surveyDimensionDetail = null;
|
|
|
surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode,diseaJson.getString("labelName") , label, "疾病类型", 2, surveyCode);
|
|
|
surveyDimensionDetail = new SurveyDimensionDetail(dimensionDetailCode, dimensionCode, diseaJson.getString("labelName"), label, "疾病类型", 2, surveyCode);
|
|
|
|
|
|
/*switch (Integer.parseInt(disea.toString())) {
|
|
|
// 1.高血压 2糖尿病 3.高血压+糖尿病
|
|
@ -227,10 +227,10 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
}
|
|
|
// List<String> codes = getCount(surveyTarget.toString());
|
|
|
JSONObject countJson = new JSONObject();
|
|
|
countJson.put("sex",sexList);
|
|
|
countJson.put("disease",diseaList);
|
|
|
countJson.put("healthCondition",healthList);
|
|
|
countJson.put("service",servList);
|
|
|
countJson.put("sex", sexList);
|
|
|
countJson.put("disease", diseaList);
|
|
|
countJson.put("healthCondition", healthList);
|
|
|
countJson.put("service", servList);
|
|
|
List<String> codes = getCount(countJson.toString());
|
|
|
int amount = codes.size();
|
|
|
for (String code : codes) {
|
|
@ -1480,11 +1480,11 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
String sql = " SELECT DISTINCT t.label_name ,t.label_code " +
|
|
|
" from wlyy_sign_patient_label t " +
|
|
|
" where t.label_type = ?";
|
|
|
" where t.status = 1 and t.label_type = ? ORDER BY t.label_code ";
|
|
|
List<Map<String, Object>> health = jdbcTemplate.queryForList(sql, 2);
|
|
|
List<Map<String, Object>> disea = jdbcTemplate.queryForList(sql, 3);
|
|
|
String querySql = " SELECT DISTINCT t.code,t.name from wlyy_sign_dict t " +
|
|
|
" where t.type=1 and `year`='2017' ";
|
|
|
" where `year`='2017' ORDER BY t.code ";
|
|
|
List<Map<String, Object>> servi = jdbcTemplate.queryForList(querySql);
|
|
|
|
|
|
List healthCodition = new ArrayList();
|
|
@ -1635,6 +1635,8 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
public List<String> getCount(String json) {
|
|
|
// 1.服务 2.健康 3疾病
|
|
|
JSONObject jsonObject = new JSONObject(json);
|
|
|
String sql = "";
|
|
|
|
|
|
String sex = jsonObject.get("sex").toString();
|
|
|
String str = "SELECT DISTINCT lb.patient FROM wlyy_sign_patient_label_info lb,(SELECT DISTINCT ff.patient FROM wlyy_sign_family_server s, " +
|
|
|
" (SELECT f.`code`,f.patient FROM wlyy_sign_family f,wlyy_patient p WHERE p.CODE=f.patient ";
|
|
@ -1659,11 +1661,13 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
}
|
|
|
ser += " OR ";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(ser)) {
|
|
|
if (StringUtils.isNotEmpty(ser)) {
|
|
|
str += " AND ( " + ser.substring(0, ser.lastIndexOf("OR")) + " ) ";
|
|
|
}
|
|
|
str += " )tt WHERE lb.patient=tt.patient ";
|
|
|
|
|
|
JSONArray healthCondition = jsonObject.getJSONArray("healthCondition");
|
|
|
String healSql = "";
|
|
|
String heal = "";
|
|
|
health:
|
|
|
for (Object health : healthCondition) {
|
|
@ -1677,10 +1681,12 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
}
|
|
|
heal += " OR ";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(heal)) {
|
|
|
str += " AND ( (lb.label_type =2 AND ( " + heal.substring(0, heal.lastIndexOf("OR")) + " ) " + " ) ";
|
|
|
if (StringUtils.isNotEmpty(heal)) {
|
|
|
healSql = " (lb.label_type =2 AND ( " + heal.substring(0, heal.lastIndexOf("OR")) + " ) )";
|
|
|
}
|
|
|
|
|
|
JSONArray disease = jsonObject.getJSONArray("disease");
|
|
|
String disSql = "";
|
|
|
String dis = "";
|
|
|
disea:
|
|
|
for (Object disea : disease) {
|
|
@ -1689,27 +1695,27 @@ public class ManagerQuestionnaireService extends BaseService {
|
|
|
case "0":
|
|
|
break disea;
|
|
|
default:
|
|
|
dis += " lb.label= "+type;
|
|
|
dis += " lb.label= " + type;
|
|
|
break;
|
|
|
}
|
|
|
dis += " OR ";
|
|
|
}
|
|
|
if (StringUtils.isEmpty(heal)){
|
|
|
if (!StringUtils.isEmpty(dis)) {
|
|
|
str += " AND ( lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " ) " + " )";
|
|
|
}else {
|
|
|
str += " )";
|
|
|
}
|
|
|
}else {
|
|
|
if (!StringUtils.isEmpty(dis)) {
|
|
|
str += " OR ( lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " ) " + " ) )";
|
|
|
}else {
|
|
|
str += " )";
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(dis)) {
|
|
|
disSql= " (lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " ) )";
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isEmpty(heal) && StringUtils.isEmpty(dis)) {
|
|
|
sql = str;
|
|
|
} else if (StringUtils.isEmpty(heal) && StringUtils.isNotEmpty(dis)) {
|
|
|
sql = str + " AND " +disSql;
|
|
|
} else if (StringUtils.isNotEmpty(heal) && StringUtils.isEmpty(dis)) {
|
|
|
sql = str + " AND " +healSql;
|
|
|
} else if (StringUtils.isNotEmpty(heal) && StringUtils.isNotEmpty(dis)) {
|
|
|
sql = str + " AND ( " + disSql +" OR " +healSql +" ) ";
|
|
|
}
|
|
|
|
|
|
System.out.println("=====query sql =======>>>>" + str);
|
|
|
List<String> patients = jdbcTemplate.queryForList(str, String.class);
|
|
|
System.out.println("=====query sql =======>>>>" + sql);
|
|
|
List<String> patients = jdbcTemplate.queryForList(sql, String.class);
|
|
|
return patients;
|
|
|
}
|
|
|
|