年龄分布查询异常问题修复

master
gongzhenkun 2 years ago
parent 99349e2ae5
commit 99cf641da9

@ -8,7 +8,6 @@ import com.ruoyi.system.mapper.TRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -77,13 +76,13 @@ public class PlatformService {
public Map<String,Long> ageCount(Long hospitalId, Long doctorId) {
List<TPatient> tPatients = tRecordMapper.ageCount(hospitalId, doctorId);
//20-30
long count20 = tPatients.stream().filter(a -> a.getAge() >= 20 && a.getAge() <= 30).count();
long count20 = tPatients.stream().filter(a -> a.getAge() != null && a.getAge() >= 20 && a.getAge() <= 30).count();
//31-40
long count31 = tPatients.stream().filter(a -> a.getAge() >= 31 && a.getAge() <= 40).count();
long count31 = tPatients.stream().filter(a -> a.getAge() != null && a.getAge() >= 31 && a.getAge() <= 40).count();
//41-50
long count41 = tPatients.stream().filter(a -> a.getAge() >= 41 && a.getAge() <= 50).count();
long count41 = tPatients.stream().filter(a -> a.getAge() != null && a.getAge() >= 41 && a.getAge() <= 50).count();
//51-
long count51 = tPatients.stream().filter(a -> a.getAge() >= 51).count();
long count51 = tPatients.stream().filter(a -> a.getAge() != null && a.getAge() >= 51).count();
Map<String,Long> map = new HashMap<String,Long>(){{
put("count20",count20);
put("count31",count31);

Loading…
Cancel
Save