|
@ -330,9 +330,6 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
// 缴费类型
|
|
|
json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
|
|
|
// if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
|
|
|
// json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// }
|
|
|
if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
|
|
|
String epTime = "";
|
|
|
try {
|
|
@ -478,9 +475,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
// 缴费类型
|
|
|
json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
// if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
|
|
|
// json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
|
|
|
String epTime = "";
|
|
|
try {
|
|
@ -508,7 +503,6 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询某个标签类型的所有标签居民数统计
|
|
|
*
|
|
@ -652,7 +646,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取团队签约人数
|
|
|
*
|
|
|
* @param teamCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public int getPatientAmountByTeam(Long teamCode) throws Exception {
|
|
|
List<SignFamily> signFamilies = signFamilyDao.findByAdminTeamIdAndStatus(teamCode, 1);
|
|
@ -713,7 +711,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" from " +
|
|
|
" wlyy_sign_family " +
|
|
|
" where status > 0 " +
|
|
|
(teamCode > 0 ? " and admin_team_code = ? " : "");
|
|
|
" and admin_team_code = ? ";
|
|
|
|
|
|
if (label.getLabelCode().equals("1")) {
|
|
|
int week = today.get(Calendar.DAY_OF_WEEK) - 2;
|
|
@ -734,11 +732,8 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
} else {
|
|
|
throw new Exception("label is not exist");
|
|
|
}
|
|
|
if (teamCode > 0) {
|
|
|
args = new Object[]{teamCode, teamCode};
|
|
|
} else {
|
|
|
args = new Object[]{};
|
|
|
}
|
|
|
|
|
|
args = new Object[]{teamCode};
|
|
|
} else {
|
|
|
if (label.getLabelCode().equals("0")) {
|
|
|
sql = " SELECT " +
|
|
@ -746,18 +741,14 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" FROM" +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" left join " +
|
|
|
" (select repl.patient,repl.label,repl.label_type,repl.label_name from wlyy_sign_family repf left join wlyy_sign_patient_label_info repl on repf.patient = repl.patient where repf.status > 0 and repl.label_type = ? and repl.status = 1) t2 " +
|
|
|
" (select repl.patient,repl.label,repl.label_type,repl.label_name from wlyy_sign_family repf left join wlyy_sign_patient_label_info repl on repf.patient = repl.patient where repf.admin_team_code = ? and repf.status > 0 and repl.label_type = ? and repl.status = 1) t2 " +
|
|
|
" on t1.patient = t2.patient " +
|
|
|
" WHERE" +
|
|
|
" t2.patient is null " +
|
|
|
" AND t1.status > 0 " +
|
|
|
(teamCode > 0 ? " AND t1.admin_team_code = ? " : "");
|
|
|
" AND t1.admin_team_code = ? ";
|
|
|
|
|
|
if (teamCode > 0) {
|
|
|
args = new Object[]{labelType, teamCode, labelType, teamCode};
|
|
|
} else {
|
|
|
args = new Object[]{labelType, labelType};
|
|
|
}
|
|
|
args = new Object[]{teamCode, labelType, teamCode};
|
|
|
} else {
|
|
|
sql = " SELECT " +
|
|
|
" t1.* " +
|
|
@ -770,20 +761,13 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" AND t2.label_type = ? " +
|
|
|
" AND t2.status = 1 " +
|
|
|
" AND t1.status > 0 " +
|
|
|
(teamCode > 0 ? " AND t1.admin_team_code = ? " : "");
|
|
|
" AND t1.admin_team_code = ? ";
|
|
|
|
|
|
if (teamCode > 0) {
|
|
|
args = new Object[]{label.getLabelCode(), labelType, teamCode, label.getLabelCode(), labelType, teamCode};
|
|
|
} else {
|
|
|
args = new Object[]{label.getLabelCode(), labelType, label.getLabelCode(), labelType};
|
|
|
}
|
|
|
args = new Object[]{label.getLabelCode(), labelType, teamCode};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String sqlDoc = sql.replaceAll("repdoctor", "doctor");
|
|
|
String sqlDocHealth = sql.replaceAll("repdoctor", "doctor_health").replaceAll("t1", "t3").replaceAll("t2", "t4").replaceAll("repf", "repf1").replaceAll("repl", "repl1");
|
|
|
|
|
|
sql = "select count(DISTINCT t.patient) count from (" + sqlDoc + " union all " + sqlDocHealth + ") t";
|
|
|
sql = "select count(DISTINCT t.patient) count from (" + sql +") t";
|
|
|
|
|
|
List<Map<String, Object>> count = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
@ -1571,7 +1555,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
" 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 admin_team_code = " + teamCode +
|
|
|
" AND (t1.name like ? or t2.label_name like ?) ";
|
|
|
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
@ -1672,9 +1656,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
// 缴费类型
|
|
|
json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
// if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
|
|
|
// json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
|
|
|
String epTime = "";
|
|
|
try {
|
|
@ -1805,10 +1787,71 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
String sql = "";
|
|
|
Object[] args = null;
|
|
|
|
|
|
String tempsql = " select * from wlyy_sign_family where " +
|
|
|
" status > 0 and admin_team_code = ? ";
|
|
|
args = new Object[]{teamCode};
|
|
|
sql = "select t.* from (" + tempsql + ") t limit " + start + "," + pagesize;
|
|
|
if (labelType.equals("5")) {
|
|
|
Calendar today = Calendar.getInstance();
|
|
|
Calendar startDate = Calendar.getInstance();
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
sql = "select * " +
|
|
|
" from " +
|
|
|
" wlyy_sign_family " +
|
|
|
" where status > 0 and admin_team_code = ? ";
|
|
|
|
|
|
if (labelCode.equals("1")) {
|
|
|
int week = today.get(Calendar.DAY_OF_WEEK) - 2;
|
|
|
|
|
|
if (week == -1) {
|
|
|
week = 6;
|
|
|
}
|
|
|
startDate.add(Calendar.DATE, -week);
|
|
|
sql += " and apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
|
|
|
+ "' and '" + (df.format(today.getTime()) + " 23:59:59'");
|
|
|
} else if (labelCode.equals("2")) {
|
|
|
startDate.set(Calendar.DATE, 1);
|
|
|
sql += " and apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
|
|
|
+ "' and '" + (df.format(today.getTime()) + " 23:59:59'");
|
|
|
} else if (labelCode.equals("3")) {
|
|
|
startDate.add(Calendar.DATE, 30);
|
|
|
sql += " and end between '" + (df.format(today.getTime()) + " 00:00:00")
|
|
|
+ "' and '" + (df.format(startDate.getTime()) + " 23:59:59'");
|
|
|
} else {
|
|
|
throw new Exception("label is not exist");
|
|
|
}
|
|
|
|
|
|
args = new Object[]{teamCode};
|
|
|
} else {
|
|
|
if (labelCode.equals("0")) {
|
|
|
sql = "SELECT " +
|
|
|
" t1.* " +
|
|
|
" FROM " +
|
|
|
" wlyy_sign_family t1 " +
|
|
|
" left join " +
|
|
|
" (select repl.patient,repl.label,repl.label_type,repl.label_name from wlyy_sign_family repf left join wlyy_sign_patient_label_info repl on repf.patient = repl.patient where repf.admin_team_code = ? and repf.status > 0 and repl.label_type = ? and repl.status = 1) t2 " +
|
|
|
" on t1.patient = t2.patient " +
|
|
|
" WHERE " +
|
|
|
" t2.patient is null " +
|
|
|
" AND t1.status > 0 " +
|
|
|
" AND t1.admin_team_code = ? ";
|
|
|
|
|
|
args = new Object[]{teamCode, labelType, teamCode};
|
|
|
} else {
|
|
|
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.status > 0 " +
|
|
|
" AND t1.admin_team_code = ? ";
|
|
|
|
|
|
args = new Object[]{labelCode, labelType, teamCode};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sql = sql + " limit " + start + "," + pagesize;
|
|
|
signList = jdbcTemplate.queryForList(sql, args);
|
|
|
|
|
|
if (signList != null && signList.size() > 0) {
|
|
@ -1843,24 +1886,11 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(labelCode)) {
|
|
|
SignPatientLabelInfo labelInfoEx = labelInfoDao.findByPatientAndLabelAndLabelTypeAndStatus(p.getCode(), labelCode, labelType, 1);
|
|
|
|
|
|
if (labelInfoEx == null) {
|
|
|
continue;
|
|
|
}
|
|
|
} else if (StringUtils.isNotEmpty(labelType)) {
|
|
|
List<SignPatientLabelInfo> labelExs = labelInfoDao.findByPatientAndLabelTypeAndStatus(p.getCode(), labelType, 1);
|
|
|
|
|
|
if (labelExs == null && labelExs.size() <= 0) {
|
|
|
continue;
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
List<SignPatientLabelInfo> labels = labelInfoDao.findByPatientAndStatus(sign.get("patient").toString(), 1);
|
|
|
//List<SignPatientLabelInfo> labels = labelInfoDao.findByPatientAndStatus(sign.get("patient").toString(), 1);
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
|
// 设置患者标识
|
|
@ -1896,9 +1926,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
|
|
|
// 缴费类型
|
|
|
json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
|
|
|
// if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
|
|
|
// json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
|
|
|
String epTime = "";
|
|
|
try {
|
|
@ -1917,7 +1945,7 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
json.put("expensesStatus", "1");
|
|
|
}
|
|
|
// 患者标签
|
|
|
json.put("labels", labels == null ? "" : labels);
|
|
|
//json.put("labels", labels == null ? "" : labels);
|
|
|
|
|
|
result.put(p.getCode(), json);
|
|
|
}
|