|
@ -639,7 +639,8 @@ public class ResourceBrowseDao {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Page<Map<String, Object>> getMysqlDataAndCondition(String sql,String queryParam,String sortParam,Integer page, Integer size,List<String> resourcesCodes) throws Exception {
|
|
|
public Page<Map<String, Object>> getMysqlDataAndCondition(String sql,String queryParam,String sortParam,Integer page,
|
|
|
Integer size,List<String> resourcesCodes,int dataSource) throws Exception {
|
|
|
String sortOrder = "";
|
|
|
String sortOrderSql = "";
|
|
|
if (StringUtils.isNoneBlank(sortParam)){
|
|
@ -661,6 +662,9 @@ public class ResourceBrowseDao {
|
|
|
if (StringUtils.isNoneBlank(queryParam)){
|
|
|
queryParam =" where 1=1 "+ queryParam;
|
|
|
}
|
|
|
if(dataSource==2){
|
|
|
queryParam = "";
|
|
|
}
|
|
|
//判定是否完整sql语句
|
|
|
sql =sql+queryParam+sortOrderSql;
|
|
|
//查询总条数
|
|
@ -802,6 +806,152 @@ public class ResourceBrowseDao {
|
|
|
return new PageImpl<>(list, PageRequest.of(page - 1, size), count);
|
|
|
}
|
|
|
|
|
|
public String transforParamValue(String paramValue){
|
|
|
if(StringUtils.isBlank(paramValue)){
|
|
|
return paramValue;
|
|
|
}
|
|
|
paramValue = paramValue.replaceAll("filterAreaCode","");
|
|
|
paramValue = paramValue.replaceAll("filterCreateTimeF","");
|
|
|
paramValue = paramValue.replaceAll("filterCreateTimeR","");
|
|
|
paramValue = paramValue.replaceAll("filterCreateTime","");
|
|
|
paramValue = paramValue.replaceAll("filterManagedTimeShort","");
|
|
|
paramValue = paramValue.replaceAll("filterExitTimeShort","");
|
|
|
paramValue = paramValue.replaceAll("filterLostVisitTimeShort","");
|
|
|
paramValue = paramValue.replaceAll("filterUnmanagedTimeShort","");
|
|
|
paramValue = paramValue.replaceAll("filterEntryTimeShort","");
|
|
|
paramValue = paramValue.replaceAll("filterAssignTimeShort","");
|
|
|
paramValue = paramValue.replaceAll("filterEndTime","");
|
|
|
paramValue = paramValue.replaceAll("filterFollowupDate","");
|
|
|
paramValue = paramValue.replaceAll("filterExamineTime","");
|
|
|
paramValue = paramValue.replaceAll("filterCheckTime","");
|
|
|
paramValue = paramValue.replaceAll("filterDateHH","");
|
|
|
paramValue = paramValue.replaceAll("filterWatchTime","");
|
|
|
paramValue = paramValue.replaceAll("filterYesterday","");
|
|
|
return paramValue;
|
|
|
}
|
|
|
/**
|
|
|
* 参数处理
|
|
|
* copdgroup 管理状态
|
|
|
* date 时间
|
|
|
* groupScreeningStatus1 分组
|
|
|
* hospital 社区医院
|
|
|
* org 等级医院
|
|
|
* town 区
|
|
|
* @param paramValue
|
|
|
* @param dataMap
|
|
|
* @return
|
|
|
*/
|
|
|
public String transforParamValue(String paramValue,Map<String,String> dataMap){
|
|
|
if(StringUtils.isBlank(paramValue)){
|
|
|
return paramValue;
|
|
|
}
|
|
|
String filterAreaCode = "";
|
|
|
String filterCreateTime= "";
|
|
|
String filterCreateTimeF= "";// f.create_time
|
|
|
String filterCreateTimeR= "";// r.create_time
|
|
|
String filterFollowupDate= "";// f.followup_date
|
|
|
String filterExamineTime= "";// a.examine_time
|
|
|
String filterCheckTime= "";// a.check_time
|
|
|
String filterDateHH= "";// hh.date
|
|
|
String filterWatchTime= "";// a.watch_time
|
|
|
String filterManagedTimeShort= "";//a.managed_time_short `status`='1'
|
|
|
String filterExitTimeShort= "";//a.exit_time_short `status`='3'
|
|
|
String filterLostVisitTimeShort= "";//a.lost_visit_time_short `status`='2'
|
|
|
String filterUnmanagedTimeShort= "";//a.unmanaged_time_short `status`='4'
|
|
|
String filterEntryTimeShort= "";//a.entry_time_short
|
|
|
String filterAssignTimeShort= "";//a.assign_time_short
|
|
|
String filterEndTime= "";//r.end_time
|
|
|
String filterYesterday= "";// yesterdayWatchNum
|
|
|
String startDate = dataMap.get("startDate");//结束时间
|
|
|
String endDate = dataMap.get("endDate");//开始时间
|
|
|
String filterCommon = "";
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
String startDateShort = startDate.replaceAll("-","");
|
|
|
String startDate2 = startDate.replace("-", "/");
|
|
|
filterCreateTime += " and a.create_time>='"+startDate+"' ";
|
|
|
filterExamineTime += " and a.examine_time>='"+startDate+"' ";
|
|
|
filterCheckTime += " and a.check_time>='"+startDate+"' ";
|
|
|
filterCreateTimeF += " and f.create_time>='"+startDate+"' ";
|
|
|
filterCreateTimeR += " and r.create_time>='"+startDate+"' ";
|
|
|
filterFollowupDate += " and f.followup_date>='"+startDate+"' ";
|
|
|
filterWatchTime += " and a.watch_time>='"+startDate+"' ";
|
|
|
filterDateHH += " and hh.date>='"+startDate+"' ";
|
|
|
filterManagedTimeShort += " and a.managed_time_short>='"+startDateShort+"' ";
|
|
|
filterExitTimeShort += " and a.exit_time_short>='"+startDateShort+"' ";
|
|
|
filterLostVisitTimeShort += " and a.lost_visit_time_short>='"+startDateShort+"' ";
|
|
|
filterUnmanagedTimeShort += " and a.unmanaged_time_short>='"+startDateShort+"' ";
|
|
|
filterEntryTimeShort += " and a.entry_time_short>='"+startDateShort+"' ";
|
|
|
filterAssignTimeShort += " and a.assign_time_short>='"+startDateShort+"' ";
|
|
|
filterEndTime += " and r.end_time>='"+startDate2+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
String endDateShort = endDate.replaceAll("-","");
|
|
|
String endDate2 = endDate.replace("-", "/");
|
|
|
filterCreateTime += " and a.create_time<='"+endDate+" 23:59:59' ";
|
|
|
filterExamineTime += " and a.examine_time<='"+endDate+" 23:59:59' ";
|
|
|
filterCheckTime += " and a.check_time<='"+endDate+" 23:59:59' ";
|
|
|
filterCreateTimeF += " and f.create_time<='"+endDate+" 23:59:59' ";
|
|
|
filterCreateTimeR += " and r.create_time<='"+endDate+" 23:59:59' ";
|
|
|
filterFollowupDate += " and f.followup_date<='"+endDate+" 23:59:59' ";
|
|
|
filterWatchTime += " and a.watch_time<='"+endDate+" 23:59:59' ";
|
|
|
filterDateHH += " and hh.date<='"+endDate+" 23:59:59' ";
|
|
|
filterManagedTimeShort += " and a.managed_time_short<='"+endDateShort+"' ";
|
|
|
filterExitTimeShort += " and a.exit_time_short<='"+endDateShort+"' ";
|
|
|
filterLostVisitTimeShort += " and a.lost_visit_time_short<='"+endDateShort+"' ";
|
|
|
filterUnmanagedTimeShort += " and a.unmanaged_time_short<='"+endDateShort+"' ";
|
|
|
filterEntryTimeShort += " and a.entry_time_short<='"+endDateShort+"' ";
|
|
|
filterAssignTimeShort += " and a.assign_time_short<='"+endDateShort+"' ";
|
|
|
filterEndTime += " and r.end_time<='"+endDate2+"' ";
|
|
|
filterYesterday = DateUtil.getNextDay(endDate,-1);
|
|
|
}else {
|
|
|
filterYesterday = DateUtil.getNextDay(new Date(),-1);
|
|
|
}
|
|
|
|
|
|
for (Map.Entry<String,String> entry : dataMap.entrySet()) {
|
|
|
String key = entry.getKey();
|
|
|
String value = entry.getValue();
|
|
|
if("copdgroup".equals(key)){
|
|
|
//管理状态
|
|
|
filterCommon += " and a.status='"+value+"' ";
|
|
|
}
|
|
|
if("groupScreeningStatus1".equals(key)){
|
|
|
//分组
|
|
|
filterCommon += " and a.group_screening_status='"+value+"' ";
|
|
|
}
|
|
|
if("town".equals(key)){
|
|
|
//区
|
|
|
filterAreaCode += " and h.town = '"+value+"' ";
|
|
|
}
|
|
|
if("org".equals(key)){
|
|
|
//等级医院
|
|
|
filterAreaCode += " and d.class_name = '"+value+"' ";
|
|
|
}
|
|
|
if("hospital".equals(key)){
|
|
|
//社区医院
|
|
|
filterAreaCode += " and h.code = '"+value+"' ";
|
|
|
}
|
|
|
}
|
|
|
filterCreateTime += filterCommon;
|
|
|
paramValue = paramValue.replaceAll("filterAreaCode",filterAreaCode);
|
|
|
paramValue = paramValue.replaceAll("filterCreateTimeF",filterCreateTimeF);
|
|
|
paramValue = paramValue.replaceAll("filterCreateTimeR",filterCreateTimeR);
|
|
|
paramValue = paramValue.replaceAll("filterCreateTime",filterCreateTime);
|
|
|
paramValue = paramValue.replaceAll("filterManagedTimeShort",filterManagedTimeShort);
|
|
|
paramValue = paramValue.replaceAll("filterExitTimeShort",filterExitTimeShort);
|
|
|
paramValue = paramValue.replaceAll("filterLostVisitTimeShort",filterLostVisitTimeShort);
|
|
|
paramValue = paramValue.replaceAll("filterUnmanagedTimeShort",filterUnmanagedTimeShort);
|
|
|
paramValue = paramValue.replaceAll("filterEntryTimeShort",filterEntryTimeShort);
|
|
|
paramValue = paramValue.replaceAll("filterAssignTimeShort",filterAssignTimeShort);
|
|
|
paramValue = paramValue.replaceAll("filterEndTime",filterEndTime);
|
|
|
paramValue = paramValue.replaceAll("filterFollowupDate",filterFollowupDate);
|
|
|
paramValue = paramValue.replaceAll("filterExamineTime",filterExamineTime);
|
|
|
paramValue = paramValue.replaceAll("filterCheckTime",filterCheckTime);
|
|
|
paramValue = paramValue.replaceAll("filterDateHH",filterDateHH);
|
|
|
paramValue = paramValue.replaceAll("filterWatchTime",filterWatchTime);
|
|
|
paramValue = paramValue.replaceAll("filterYesterday",filterYesterday);
|
|
|
|
|
|
return paramValue;
|
|
|
}
|
|
|
//参数处理
|
|
|
public String transforParam(String paramSql,String tableSql,Map<String,String> dataMap){
|
|
|
if(StringUtils.isBlank(paramSql)){
|
|
@ -901,6 +1051,7 @@ public class ResourceBrowseDao {
|
|
|
if (StringUtils.isNoneBlank(sortOrder)){
|
|
|
sortOrderSql +=" order by "+sortOrder.substring(0,sortOrder.length()-1);
|
|
|
}
|
|
|
tableSql = transforParamValue(tableSql);
|
|
|
tableSql = transforParam(paramSql,tableSql,null);
|
|
|
//判定是否完整sql语句
|
|
|
sql = "select T.* from " + tableSql +sortOrderSql;
|