Compare commits

..

No commits in common. 'c08b655a3fc0682f8443e8419db17dd21c633d6e' and 'ebb2edfb7693b9c19fcc383db23fe9a5d5458c35' have entirely different histories.

@ -68,7 +68,7 @@ public class TRecordController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody @Validated TRecordResultReq tRecord)
{
startPage();
// startPage();
List<TRecordResp> list = tRecordService.selectTRecordListWithoutResult(tRecord);
if(CollectionUtils.isNotEmpty(list)){
list.stream().forEach(tRecordResp -> {

@ -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.*;
import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author zhuqing
@ -64,32 +64,7 @@ public class PlatformService {
* @return
*/
public List<WeekMonthPersonCountResp> weekMonthPersonCount(Long hospitalId, Long doctorId,Long 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;
return tRecordMapper.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
}
/**

@ -201,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="weekMonthPersonCount" resultType="com.ruoyi.system.domain.resp.WeekMonthPersonCountResp">
select date_format(X.create_time, '%Y-%m-%d') createTime, count(*) count
select date_format(create_time, '%Y-%m-%d') createTime, count(*) count
from
<if test="weekMonth == 1 || weekMonth == null">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt;= date(create_time)) X
@ -212,8 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where X.status = '1'
<if test="doctorId != null "> and X.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and X.hospital_id = #{hospitalId}</if>
group by date_format(X.create_time, '%Y-%m-%d')
order by date_format(X.create_time, '%Y-%m-%d' ) asc
group by date_format(X.create_time, '%Y-%m-%d');
</select>
<select id="ageCount" resultType="com.ruoyi.system.domain.TPatient">

Loading…
Cancel
Save