|
@ -109,20 +109,37 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
args = new Object[]{doctor, teamCode};
|
|
|
} else {
|
|
|
if (labelCode.equals("0")) {
|
|
|
sql = "select a.*" +
|
|
|
" from" +
|
|
|
" (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
|
|
|
" left join" +
|
|
|
" (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
|
|
|
" on a.patient = b.patient where b.patient is null limit " + start + "," + pagesize;
|
|
|
args = new Object[]{doctor, teamCode, labelType};
|
|
|
sql = "SELECT " +
|
|
|
" t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" left join " +
|
|
|
" wlyy_sign_patient_label_info t2 " +
|
|
|
" on t1.patient = t2.patient " +
|
|
|
" WHERE " +
|
|
|
" t2.label_type = ? " +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND t2.patient is null " +
|
|
|
" AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
|
|
|
" AND t1.status > 0 " +
|
|
|
" AND t1.admin_team_code = ? limit " + start + "," + pagesize;
|
|
|
|
|
|
args = new Object[]{labelType, doctor, teamCode};
|
|
|
} else {
|
|
|
sql = "select a.*" +
|
|
|
" from" +
|
|
|
" (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
|
|
|
" join" +
|
|
|
" (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
|
|
|
" on a.patient = b.patient limit " + start + "," + pagesize;
|
|
|
sql = "SELECT " +
|
|
|
" t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1, " +
|
|
|
" wlyy_sign_patient_label_info t2 " +
|
|
|
" WHERE " +
|
|
|
" t2.label = ? " +
|
|
|
" AND t2.label_type = ? " +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND t1.patient = t2.patient " +
|
|
|
" AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
|
|
|
" AND t1.status > 0 " +
|
|
|
" AND t1.admin_team_code = ? limit " + start + "," + pagesize;
|
|
|
|
|
|
args = new Object[]{doctor, teamCode, labelCode, labelType};
|
|
|
}
|
|
|
}
|
|
@ -347,30 +364,45 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
} else {
|
|
|
if (label.getLabelCode().equals("0")) {
|
|
|
sql = "select count(DISTINCT a.patient) count" +
|
|
|
" from" +
|
|
|
" (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
|
|
|
(teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
|
|
|
" left join" +
|
|
|
" (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
|
|
|
" on a.patient = b.patient where b.patient is null ";
|
|
|
sql = " SELECT " +
|
|
|
" count(DISTINCT t1.patient) count " +
|
|
|
" FROM" +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" left join " +
|
|
|
" wlyy_sign_patient_label_info t2 " +
|
|
|
" on t1.patient = t2.patient " +
|
|
|
" WHERE" +
|
|
|
" t2.label_type = ? " +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND t2.patient is null " +
|
|
|
" AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
|
|
|
" AND t1.status > 0 " +
|
|
|
(teamCode > 0 ? " AND t1.admin_team_code = ? " : "");
|
|
|
|
|
|
if (teamCode > 0) {
|
|
|
args = new Object[]{doctor, teamCode, labelType};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, labelType};
|
|
|
}
|
|
|
} else {
|
|
|
sql = "select count(DISTINCT a.patient) count" +
|
|
|
" from" +
|
|
|
" (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
|
|
|
(teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
|
|
|
" join" +
|
|
|
" (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
|
|
|
" on a.patient = b.patient ";
|
|
|
sql = " SELECT " +
|
|
|
" count(DISTINCT t1.patient) count " +
|
|
|
" FROM" +
|
|
|
" wlyy_sign_family t1, " +
|
|
|
" wlyy_sign_patient_label_info t2 " +
|
|
|
" WHERE" +
|
|
|
" t1.patient = t2.patient " +
|
|
|
" AND t2.label = ? " +
|
|
|
" AND t2.label_type = ? " +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
|
|
|
" AND t1.status > 0 " +
|
|
|
(teamCode > 0 ? " AND t1.admin_team_code = ? " : "");
|
|
|
|
|
|
if (teamCode > 0) {
|
|
|
args = new Object[]{doctor, teamCode, label.getLabelCode(), labelType};
|
|
|
args = new Object[]{label.getLabelCode(), labelType, doctor, teamCode};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, label.getLabelCode(), labelType};
|
|
|
args = new Object[]{label.getLabelCode(), labelType, doctor};
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -587,22 +619,30 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
|
|
|
Map<String, JSONObject> result = new HashMap<>();
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
page = page*pagesize;
|
|
|
page = page * pagesize;
|
|
|
Object[] args = null;
|
|
|
String sql = "select a.*" +
|
|
|
" from" +
|
|
|
" (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
|
|
|
(teamCode > 0 ? (" and admin_team_code = " + teamCode) : "") + " ) a" +
|
|
|
(StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ? " join " : " left join ")+
|
|
|
" (select * from wlyy_sign_patient_label_info where status = 1 " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " and label = ? " : "") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " and label_type = ? " : "") + ") b" +
|
|
|
" on a.patient = b.patient where a.name like ? or b.label_name like ? limit " + page + "," + pagesize;
|
|
|
String sql = "SELECT " +
|
|
|
" t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
(StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ?
|
|
|
" join " : " left join ") +
|
|
|
" wlyy_sign_patient_label_info t2 " +
|
|
|
" ON t1.patient = t2.patient " +
|
|
|
" WHERE " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " t2.label = ? " : "") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " and t2.label_type = ? " : "") +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
|
|
|
" AND t1.status > 0 " +
|
|
|
" AND (t1.name like ? OR t2.label_name like ?) " +
|
|
|
(teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")
|
|
|
+ " limit " + page + "," + pagesize;
|
|
|
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{doctor, labelCode, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
args = new Object[]{labelCode, labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
args = new Object[]{doctor, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
args = new Object[]{labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
}
|