|
@ -326,11 +326,10 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
//慢病管理
|
|
|
sql = "SELECT " +
|
|
|
" DISTINCT t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1, " +
|
|
|
" wlyy_sign_patient_label_info t2 ";
|
|
|
" FROM wlyy_sign_family t1 " +
|
|
|
" RIGHT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient ";
|
|
|
if(StringUtils.isNotBlank(diseaseCondition)) {
|
|
|
sql = sql + ", wlyy_patient p ";
|
|
|
sql = sql + " LEFT JOIN wlyy_patient p on p.code = t1.patient ";
|
|
|
}
|
|
|
sql = sql + " WHERE t2.label = ?";
|
|
|
|
|
@ -387,17 +386,6 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
sql += " limit " + start + "," + pagesize;
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
//查询患者设备绑定情况
|
|
|
String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
|
|
|
List<Map<String,Object>> patientCodeDeviceTypes = jdbcTemplate.queryForList(_pdsql);
|
|
|
|
|
|
if(!patientCodeDeviceTypes.isEmpty()){
|
|
|
for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
|
|
|
String user = String.valueOf(patientCodeDeviceType.get("user"));
|
|
|
String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
|
|
|
patientDeviceTypeMap.put(user,sum);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
|
for (Map<String, Object> sign : signList) {
|
|
@ -411,7 +399,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
if(sign.get("patient") != null){
|
|
|
String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
|
|
|
" left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
|
|
|
" and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
|
|
|
" where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
|
|
|
|
|
@ -525,11 +513,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
//预警状态
|
|
|
json.put("standardStatus",p.getStandardStatus());
|
|
|
//设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
|
|
|
String deviceType = "";
|
|
|
if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
|
|
|
deviceType = (String) patientDeviceTypeMap.get(p.getCode());
|
|
|
}
|
|
|
json.put("deviceType",deviceType);
|
|
|
json.put("deviceType",p.getDeviceType());
|
|
|
|
|
|
boolean epTime = false;
|
|
|
try {
|
|
@ -565,8 +549,24 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
|
|
|
|
|
|
//疾病种类
|
|
|
int disease1 = o1.has("disease")?o1.getInt("disease"):0;
|
|
|
int disease2 = o2.has("disease")?o2.getInt("disease"):0;
|
|
|
int disease1 = 0;
|
|
|
if(o1.has("disease")){
|
|
|
String diseasestr = o1.getString("disease");
|
|
|
if(diseasestr.contains(",")){
|
|
|
disease1 = 3;
|
|
|
}else{
|
|
|
disease1 = o1.getInt("disease");
|
|
|
}
|
|
|
}
|
|
|
int disease2 = 0;
|
|
|
if(o2.has("disease")){
|
|
|
String diseasestr = o2.getString("disease");
|
|
|
if(diseasestr.contains(",")){
|
|
|
disease2 = 3;
|
|
|
}else{
|
|
|
disease2 = o2.getInt("disease");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//颜色标签
|
|
|
int diseaseCondition1 = o1.has("diseaseCondition")?o1.getInt("diseaseCondition"):0;
|
|
@ -1095,27 +1095,34 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
args = new Object[]{doctor, doctor};
|
|
|
}
|
|
|
}else if(labelType.equals("3") && isSlowDisease) {
|
|
|
sql = " SELECT " +
|
|
|
" count(DISTINCT t1.patient) count" +
|
|
|
" FROM" +
|
|
|
" wlyy_sign_family t1, " +
|
|
|
" wlyy_sign_patient_label_info t2, " +
|
|
|
" wlyy_patient t3 " +
|
|
|
" WHERE" +
|
|
|
" t1.patient = t2.patient " +
|
|
|
" AND t1.patient = t3.code "+
|
|
|
" AND t2.label = ? " +
|
|
|
" AND t2.label_type = ? " +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND (t1.doctor = ? or t1.doctor_health = ?)" +
|
|
|
" AND t1.status > 0 " +
|
|
|
(teamCode > 0 ? " AND t1.admin_team_code = ? " : "");
|
|
|
|
|
|
if("1".equals(label.getLabelCode()) || "2".equals(label.getLabelCode())){
|
|
|
sql = " SELECT " +
|
|
|
" count(DISTINCT t1.patient) count" +
|
|
|
" FROM" +
|
|
|
" wlyy_sign_family t1, " +
|
|
|
" wlyy_sign_patient_label_info t2, " +
|
|
|
" wlyy_patient t3 " +
|
|
|
" WHERE" +
|
|
|
" t1.patient = t2.patient " +
|
|
|
" AND t1.patient = t3.code "+
|
|
|
" AND t2.label = ? " +
|
|
|
" AND t2.label_type = ? " +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND (t1.doctor = ? or t1.doctor_health = ?)" +
|
|
|
" AND t1.status > 0 " +
|
|
|
(teamCode > 0 ? " AND t1.admin_team_code = ? " : "")+
|
|
|
" AND t3.disease_condition = ? ";
|
|
|
|
|
|
if (teamCode > 0) {
|
|
|
args = new Object[]{label.getLabelCode(), labelType, doctor, doctor, teamCode};
|
|
|
} else {
|
|
|
args = new Object[]{label.getLabelCode(), labelType, doctor, doctor};
|
|
|
if (teamCode > 0) {
|
|
|
args = new Object[]{label.getLabelCode(), labelType, doctor, doctor, teamCode,diseaseCondition};
|
|
|
} else {
|
|
|
args = new Object[]{label.getLabelCode(), labelType, doctor, doctor,diseaseCondition};
|
|
|
}
|
|
|
}else{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
if (label.getLabelCode().equals("0")) {
|
|
|
sql = " SELECT " +
|
|
@ -1172,7 +1179,12 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
json.put("amount", amount);
|
|
|
|
|
|
int focusAmount = 0;
|
|
|
sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 ";
|
|
|
if(isSlowDisease){
|
|
|
sql += " AND t3.standard_status = 1 ";
|
|
|
}else{
|
|
|
sql += labelType.equals("5") ? " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 " : " AND LENGTH(TRIM(IFNULL(t3.openid,''))) > 0 ";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> focusCount = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
if (focusCount != null && focusCount.size() > 0 && focusCount.get(0).containsKey("count")) {
|
|
@ -3815,7 +3827,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
if(sign.get("patient") != null){
|
|
|
String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
|
|
|
" left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 AND status =1 " +
|
|
|
" and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
|
|
|
" where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
|
|
|
|
|
@ -3970,10 +3982,26 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
//患者預警狀態
|
|
|
int standardStatus1 = o1.has("standardStatus")?o1.getInt("standardStatus"):0;
|
|
|
int standardStatus2 = o2.has("standardStatus")?o2.getInt("standardStatus"):0;
|
|
|
|
|
|
|
|
|
//疾病种类
|
|
|
int disease1 = o1.has("disease")?o1.getInt("disease"):0;
|
|
|
int disease2 = o2.has("disease")?o2.getInt("disease"):0;
|
|
|
int disease1 = 0;
|
|
|
if(o1.has("disease")){
|
|
|
String diseasestr = o1.getString("disease");
|
|
|
if(diseasestr.contains(",")){
|
|
|
disease1 = 3;
|
|
|
}else{
|
|
|
disease1 = o1.getInt("disease");
|
|
|
}
|
|
|
}
|
|
|
int disease2 = 0;
|
|
|
if(o2.has("disease")){
|
|
|
String diseasestr = o2.getString("disease");
|
|
|
if(diseasestr.contains(",")){
|
|
|
disease2 = 3;
|
|
|
}else{
|
|
|
disease2 = o2.getInt("disease");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//颜色标签
|
|
|
int diseaseCondition1 = o1.has("diseaseCondition")?o1.getInt("diseaseCondition"):0;
|
|
@ -4192,36 +4220,38 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" DISTINCT t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" JOIN wlyy_sign_patient_label_info t2 ON t1.patient = t2.patient " +
|
|
|
" JOIN wlyy_sign_patient_label_info t2 ON t1.patient = t2.patient and t2.status=1 " +
|
|
|
" JOIN wlyy_patient t3 ON t1.patient = t3.code " +
|
|
|
(teamCode > 0 ? " join (select * from wlyy_sign_patient_label where label_type != '4' or team_code = " + teamCode + " or (label_type = '4' and (label_code in (1,2)))) lb on t2.label = lb.label_code and t2.label_type = lb.label_type " : "") +
|
|
|
" WHERE " +
|
|
|
" (t1.doctor = ? or t1.doctor_health = ?) " +
|
|
|
" AND t1.status > 0 " +
|
|
|
" AND t2.status = 1 " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
|
|
|
// (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
|
|
|
// (StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
|
|
|
(teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "");
|
|
|
sql = sql + " AND t3.status > 0 and t2.label_type = '3' and ( t2.label =1 or t2.lable = 2) ";
|
|
|
sql = sql + " AND t3.status > 0 and t2.label_type = '3' and ( t2.label =1 or t2.label = 2) ";
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
sql = sql + " AND (t1.idcard like ?) ";
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%"};
|
|
|
} else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
args = new Object[]{doctor, doctor, labelType, "%" + filter + "%"};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, doctor, "%" + filter + "%"};
|
|
|
}
|
|
|
// if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
// args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%"};
|
|
|
// } else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
// args = new Object[]{doctor, doctor, labelType, "%" + filter + "%"};
|
|
|
// } else {
|
|
|
// args = new Object[]{doctor, doctor, "%" + filter + "%"};
|
|
|
// }
|
|
|
args = new Object[]{doctor, doctor, "%" + filter + "%"};
|
|
|
} else {
|
|
|
sql = sql + " AND (t1.name like ? or t2.label_name like ?) ";
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
args = new Object[]{doctor, doctor, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
}
|
|
|
// if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
// args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
// } else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
// args = new Object[]{doctor, doctor, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
// } else {
|
|
|
// args = new Object[]{doctor, doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
// }
|
|
|
args = new Object[]{doctor, doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
}
|
|
|
|
|
|
|
|
@ -4235,7 +4265,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
if(sign.get("patient") != null){
|
|
|
String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
|
|
|
" left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
|
|
|
" and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
|
|
|
" where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
|
|
|
|
|
@ -4420,7 +4450,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" JOIN wlyy_patiend t2 ON t1.patient = t2.code " +
|
|
|
" JOIN wlyy_sign_patient_label_info t3 on t1.patient = t3.patient " +
|
|
|
" RIGHT JOIN wlyy_sign_patient_label_info t3 on t1.patient = t3.patient AND t3.status = 1" +
|
|
|
" WHERE " +
|
|
|
(isIdcard ? " t1.patient = t2.code and " : "") +
|
|
|
" t1.status > 0 " +
|
|
@ -4439,7 +4469,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
if(sign.get("patient") != null){
|
|
|
String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
|
|
|
" left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
|
|
|
" left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3 and status=1 " +
|
|
|
" and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
|
|
|
" where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
|
|
|
|