|
@ -15,6 +15,7 @@ import com.ccsens.ht.persist.dao.HtPositionDao; |
|
|
import com.ccsens.ht.persist.dao.HtReportDao; |
|
|
import com.ccsens.ht.persist.dao.HtReportDao; |
|
|
import com.ccsens.ht.persist.dao.StatisticsDao; |
|
|
import com.ccsens.ht.persist.dao.StatisticsDao; |
|
|
import com.ccsens.ht.uitl.Constant; |
|
|
import com.ccsens.ht.uitl.Constant; |
|
|
|
|
|
import com.ccsens.util.cron.CronConstant; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -22,10 +23,9 @@ import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.ArrayList; |
|
|
import java.text.ParseException; |
|
|
import java.util.Collection; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.Date; |
|
|
import java.util.*; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -62,7 +62,7 @@ public class StatisticsService implements IStatisticsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public StatisticsVo.Realtime realtime(Long hospitalId) { |
|
|
public StatisticsVo.Realtime realtime(Long hospitalId) throws Exception { |
|
|
//获取当前月的开始结束时间
|
|
|
//获取当前月的开始结束时间
|
|
|
long beginOfMonth = DateUtil.beginOfMonth(new Date()).getTime(); |
|
|
long beginOfMonth = DateUtil.beginOfMonth(new Date()).getTime(); |
|
|
long endOfMonth = DateUtil.endOfMonth(new Date()).getTime(); |
|
|
long endOfMonth = DateUtil.endOfMonth(new Date()).getTime(); |
|
@ -73,9 +73,39 @@ public class StatisticsService implements IStatisticsService { |
|
|
StatisticsVo.Realtime realtime = statisticsDao.getTotalNum(hospitalId,beginOfMonth,endOfMonth,beginOfDay,endOfDay); |
|
|
StatisticsVo.Realtime realtime = statisticsDao.getTotalNum(hospitalId,beginOfMonth,endOfMonth,beginOfDay,endOfDay); |
|
|
//查找折线图里的数据
|
|
|
//查找折线图里的数据
|
|
|
List<StatisticsVo.Chart> chartList = statisticsDao.getRealtimeNum(hospitalId); |
|
|
List<StatisticsVo.Chart> chartList = statisticsDao.getRealtimeNum(hospitalId); |
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
int a = 0; |
|
|
|
|
|
int b = 1; |
|
|
|
|
|
Calendar min = Calendar.getInstance(); |
|
|
|
|
|
Calendar max = Calendar.getInstance(); |
|
|
|
|
|
Calendar temp = null; |
|
|
|
|
|
List<StatisticsVo.Chart> chartListNew = new ArrayList<>(); |
|
|
|
|
|
while (b < chartList.size()){ |
|
|
|
|
|
max.setTime(sdf.parse(chartList.get(b).getType())); |
|
|
|
|
|
if(ObjectUtil.isNull(temp)){ |
|
|
|
|
|
min.setTime(sdf.parse(chartList.get(a).getType())); |
|
|
|
|
|
chartListNew.add(chartList.get(a)); |
|
|
|
|
|
temp = min; |
|
|
|
|
|
} |
|
|
|
|
|
System.out.println(sdf.format(temp.getTime())); |
|
|
|
|
|
temp.add(Calendar.DATE, 1); |
|
|
|
|
|
System.out.println(sdf.format(temp.getTime())); |
|
|
|
|
|
if(temp.before(max)){ |
|
|
|
|
|
StatisticsVo.Chart chart = new StatisticsVo.Chart(); |
|
|
|
|
|
chart.setType(sdf.format(min.getTime())); |
|
|
|
|
|
chart.setNum(0); |
|
|
|
|
|
chartListNew.add(chart); |
|
|
|
|
|
}else { |
|
|
|
|
|
a++; |
|
|
|
|
|
b++; |
|
|
|
|
|
temp = null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
chartListNew.add(chartList.get(chartList.size() - 1)); |
|
|
|
|
|
|
|
|
//返回
|
|
|
//返回
|
|
|
if(ObjectUtil.isNotNull(realtime)){ |
|
|
if(ObjectUtil.isNotNull(realtime)){ |
|
|
realtime.setChartList(chartList); |
|
|
realtime.setChartList(chartListNew); |
|
|
} |
|
|
} |
|
|
return realtime; |
|
|
return realtime; |
|
|
} |
|
|
} |
|
|