|
@ -31,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* 患者标签信息服务
|
|
@ -1129,31 +1131,54 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
page = page * pagesize;
|
|
|
Object[] args = null;
|
|
|
|
|
|
String sql = "select " +
|
|
|
" DISTINCT 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 " +
|
|
|
(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 (" + (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ? "" : " t2.patient is null OR ") + " t2.status = 1) " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
|
|
|
(teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "") +
|
|
|
" 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 + "%"};
|
|
|
String sql = "";
|
|
|
String reg = "(^\\d{15}$)|(^\\d{17}([0-9]|X)$)";
|
|
|
Pattern pattern = Pattern.compile(reg);
|
|
|
Matcher matcher = pattern.matcher(filter);
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
sql = " select DISTINCT t.* " +
|
|
|
" from" +
|
|
|
" wlyy_sign_family t join wlyy_patient p " +
|
|
|
" on t.patient = p.code " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? (" join wlyy_sign_patient_label_info l " +
|
|
|
" on t.patient = l.patient ") : "") +
|
|
|
" where " +
|
|
|
" (t.doctor = ? or t.doctor_health = ?) " +
|
|
|
(teamCode > 0 ? (" and t.admin_team_code = " + teamCode) : "") +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " and l.label = ? and l.label_type = ? " : "") +
|
|
|
" and p.idcard = ? ";
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{doctor, doctor, labelCode, labelType, filter};
|
|
|
} else {
|
|
|
args = new Object[]{doctor, doctor, filter};
|
|
|
}
|
|
|
} else {
|
|
|
args = new Object[]{doctor, doctor, "%" + filter + "%", "%" + filter + "%"};
|
|
|
sql = "select " +
|
|
|
" DISTINCT t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ?
|
|
|
" join " : " left join ") +
|
|
|
" wlyy_sign_patient_label_info t2 " +
|
|
|
" ON t1.patient = t2.patient " +
|
|
|
(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 (" + (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ? "" : " t2.patient is null OR ") + " t2.status = 1) " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
|
|
|
(teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "") +
|
|
|
" 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 + "%"};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sql += " limit " + page + "," + pagesize;
|
|
@ -1312,6 +1337,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
teams = adminTeamService.getDoctorTeams(doctor);
|
|
|
}
|
|
|
|
|
|
String reg = "(^\\d{15}$)|(^\\d{17}([0-9]|X)$)";
|
|
|
Pattern pattern = Pattern.compile(reg);
|
|
|
Matcher matcher = pattern.matcher(filter);
|
|
|
boolean isIdcard = matcher.find();
|
|
|
|
|
|
String sql = "select distinct t.* from (" +
|
|
|
" select " +
|
|
|
" f.patient " +
|
|
@ -1324,14 +1354,16 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" from " +
|
|
|
" wlyy_sign_family f,wlyy_patient p " +
|
|
|
" where " +
|
|
|
" f.patient = p.code and (f.doctor = ? or f.doctor_health = ?) and f.admin_team_code = ? and f.status > 0 and f.name like ?) " +
|
|
|
" f.patient = p.code and (f.doctor = ? or f.doctor_health = ?) and f.admin_team_code = ? and f.status > 0 and " +
|
|
|
(isIdcard ? " p.idcard = ? " : " f.name like ?") +
|
|
|
") " +
|
|
|
(page < 0 ? "" : "limit " + start + "," + size);
|
|
|
|
|
|
if (teams != null) {
|
|
|
for (AdminTeam team : teams) {
|
|
|
teamMap.put(team.getId(), team);
|
|
|
List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, team.getId(),
|
|
|
"%" + filter + "%"});
|
|
|
isIdcard ? filter : "%" + filter + "%"});
|
|
|
|
|
|
if (result != null && result.size() > 0) {
|
|
|
for (Map<String, Object> p : result) {
|
|
@ -1542,29 +1574,52 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
page = page * pagesize;
|
|
|
Object[] args = null;
|
|
|
|
|
|
String sqlTemp = "select " +
|
|
|
" DISTINCT 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 " +
|
|
|
(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.status > 0 " +
|
|
|
" AND (" + (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ? "" : " t2.patient is null OR ") + " t2.status = 1) " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
|
|
|
" AND admin_team_code = " + teamCode +
|
|
|
" AND (t1.name like ? or t2.label_name like ?) ";
|
|
|
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{labelCode, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
args = new Object[]{labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
String reg = "(^\\d{15}$)|(^\\d{17}([0-9]|X)$)";
|
|
|
Pattern pattern = Pattern.compile(reg);
|
|
|
Matcher matcher = pattern.matcher(filter);
|
|
|
String sqlTemp = "";
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
sqlTemp = " select DISTINCT t.* " +
|
|
|
" from" +
|
|
|
" wlyy_sign_family t join wlyy_patient p " +
|
|
|
" on t.patient = p.code " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? (" join wlyy_sign_patient_label_info l " +
|
|
|
" on t.patient = l.patient ") : "") +
|
|
|
" where " +
|
|
|
" t.admin_team_code = ? " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " and l.label = ? and l.label_type = ? " : "") +
|
|
|
" and p.idcard = ? ";
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{teamCode, labelCode, labelType, filter};
|
|
|
} else {
|
|
|
args = new Object[]{teamCode, filter};
|
|
|
}
|
|
|
} else {
|
|
|
args = new Object[]{"%" + filter + "%", "%" + filter + "%"};
|
|
|
sqlTemp = "select " +
|
|
|
" DISTINCT 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 " +
|
|
|
(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.status > 0 " +
|
|
|
" AND (" + (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ? "" : " t2.patient is null OR ") + " t2.status = 1) " +
|
|
|
(StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
|
|
|
(StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
|
|
|
" AND admin_team_code = " + teamCode +
|
|
|
" AND (t1.name like ? or t2.label_name like ?) ";
|
|
|
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
args = new Object[]{labelCode, labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
|
|
|
args = new Object[]{labelType, "%" + filter + "%", "%" + filter + "%"};
|
|
|
} else {
|
|
|
args = new Object[]{"%" + filter + "%", "%" + filter + "%"};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sqlTemp += " limit " + page + "," + pagesize;
|
|
@ -1704,16 +1759,23 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
Map<String, JSONObject> result = new HashMap<>();
|
|
|
List<Map<String, Object>> signList = new ArrayList<>();
|
|
|
page = page * pagesize;
|
|
|
Object[] args = new Object[]{teamCode, "%" + filter + "%"};
|
|
|
String reg = "(^\\d{15}$)|(^\\d{17}([0-9]|X)$)";
|
|
|
Pattern pattern = Pattern.compile(reg);
|
|
|
Matcher matcher = pattern.matcher(filter);
|
|
|
boolean isIdcard = matcher.find();
|
|
|
Object[] args = new Object[]{teamCode, isIdcard ? filter : "%" + filter + "%"};
|
|
|
|
|
|
String sqlTemp = "select " +
|
|
|
" DISTINCT t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
(isIdcard ? ",wlyy_patient p " : "") +
|
|
|
" WHERE " +
|
|
|
(isIdcard ? " t1.patient = p.code and " : "") +
|
|
|
" t1.status > 0 " +
|
|
|
" AND t1.admin_team_code = ? " +
|
|
|
" AND t1.name like ? ";
|
|
|
" AND" +
|
|
|
(isIdcard ? " p.idcard = ? " : " t1.name like ? ");
|
|
|
|
|
|
String sql = sqlTemp + " limit " + page + "," + pagesize;
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|