| | |
| | | } |
| | | List<ServiceDonatebaseinfo> serviceDonatebaseinfos = serviceDonatebaseinfoMapper.selectServiceDonatebaseinfoList(serviceDonatebaseinfo); |
| | | for (ServiceDonatebaseinfo serviceDonatebaseinfo1 : serviceDonatebaseinfos) { |
| | | if (serviceDonatebaseinfo1.getBirthday() != null) { |
| | | Map<String, String> map = CalculateDateUtils.calculateAge(serviceDonatebaseinfo1.getBirthday().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); |
| | | serviceDonatebaseinfo1.setAge(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | serviceDonatebaseinfo1.setAgeunit(map.get("ageUnit")); |
| | | serviceDonatebaseinfo1.setAge2(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | serviceDonatebaseinfo1.setAgeunit2(map.get("ageUnit2")); |
| | | //先给个年龄默认值(因为age是数字类型,不能放横杠,所以就所横扛放到单位上) |
| | | serviceDonatebaseinfo1.setAgeunit("-"); |
| | | serviceDonatebaseinfo1.setAge(null); |
| | | serviceDonatebaseinfo1.setAge2(null); |
| | | |
| | | //获取死亡时间,如果获取见证里有死亡时间,则进行计算他的年龄 |
| | | ServiceDonationwitness sdw = new ServiceDonationwitness(); |
| | | sdw.setInfoid(serviceDonatebaseinfo1.getId()); |
| | | List<ServiceDonationwitness> serviceDonationwitnessList = serviceDonationwitnessMapper.selectServiceDonationwitnessList(sdw); |
| | | if (!CollectionUtils.isEmpty(serviceDonationwitnessList) && serviceDonatebaseinfo1.getBirthday() != null) { |
| | | Date deathtime = serviceDonationwitnessList.get(0).getDeathtime(); |
| | | if (ObjectUtils.isNotEmpty(deathtime)) { |
| | | Map<String, String> map = CalculateDateUtils.calculateAge(serviceDonatebaseinfo1.getBirthday().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), deathtime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); |
| | | if (Objects.isNull(map)) { |
| | | log.error("ServiceDonationwitness出生日期:{},ServiceDonationwitness死亡日期:{}", serviceDonatebaseinfo1.getBirthday(), deathtime); |
| | | continue; |
| | | } |
| | | serviceDonatebaseinfo1.setAge(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | serviceDonatebaseinfo1.setAgeunit(map.get("ageUnit")); |
| | | serviceDonatebaseinfo1.setAge2(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | serviceDonatebaseinfo1.setAgeunit2(map.get("ageUnit2")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return serviceDonatebaseinfos; |
| | | } |
| | | |
| | | @Override |
| | | public List<ServiceDonatebaseinfo> getPatName(ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | List<SysRole> l = user.getRoles(); |
| | | int b = 0; |
| | | |
| | | for (SysRole r : l) { |
| | | if (r.getRoleId().longValue() == 3) { |
| | | b = 1; |
| | | } |
| | | if (r.getRoleId().longValue() == 13) { |
| | | b = 2; |
| | | } |
| | | } |
| | | if (b == 1) { |
| | | log.info("user.getUserName()的值为 ---- :{}", user.getUserName()); |
| | | serviceDonatebaseinfo.setReporterno(user.getUserName()); |
| | | } |
| | | if (b == 2) { |
| | | serviceDonatebaseinfo.setDeptid(user.getDeptId()); |
| | | } |
| | | List<ServiceDonatebaseinfo> serviceDonatebaseinfos = serviceDonatebaseinfoMapper.getPatName(serviceDonatebaseinfo); |
| | | |
| | | return serviceDonatebaseinfos; |
| | | } |