|
|
|
@ -5,12 +5,12 @@ import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
|
|
|
|
|
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
|
|
|
|
|
import com.ruoyi.system.domain.resp.WeekMonthTimeResp;
|
|
|
|
|
import com.ruoyi.system.mapper.TRecordMapper;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author zhuqing
|
|
|
|
@ -64,7 +64,32 @@ public class PlatformService {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<WeekMonthPersonCountResp> weekMonthPersonCount(Long hospitalId, Long doctorId,Long weekMonth) {
|
|
|
|
|
return tRecordMapper.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
|
|
|
|
|
List<WeekMonthPersonCountResp> list = tRecordMapper.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
|
|
|
|
|
//定义返回值
|
|
|
|
|
List<WeekMonthPersonCountResp> result = new ArrayList<>();
|
|
|
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
|
|
|
Map<Date,Integer> map = list.stream().collect(Collectors.toMap(WeekMonthPersonCountResp::getCreateTime,WeekMonthPersonCountResp::getCount,(key1, key2)->key2));
|
|
|
|
|
//获取开始日期
|
|
|
|
|
Date startDate = list.get(0).getCreateTime();
|
|
|
|
|
//获取结束日期
|
|
|
|
|
Date endDate = list.get(list.size()-1).getCreateTime();
|
|
|
|
|
while(startDate.compareTo(endDate) <= 0){
|
|
|
|
|
WeekMonthPersonCountResp resp = new WeekMonthPersonCountResp();
|
|
|
|
|
if(map.containsKey(startDate)){
|
|
|
|
|
resp.setCreateTime(startDate);
|
|
|
|
|
resp.setCount(map.get(startDate));
|
|
|
|
|
}else{
|
|
|
|
|
resp.setCreateTime(startDate);
|
|
|
|
|
resp.setCount(0);
|
|
|
|
|
}
|
|
|
|
|
result.add(resp);
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
|
cal.setTime(startDate);
|
|
|
|
|
cal.add(Calendar.DAY_OF_MONTH,1);
|
|
|
|
|
startDate = cal.getTime();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|