|
|
@ -169,17 +169,17 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
public PageInfo<PatientReportVo.ReportName> queryReports(PatientReportDto.QueryReports query, Long userId) { |
|
|
|
|
|
|
|
//查询医生信息
|
|
|
|
HtDoctorExample doctorExample = new HtDoctorExample(); |
|
|
|
doctorExample.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS).andIsDelEqualTo(Constant.Ht.NUMBER_DEFAULT); |
|
|
|
List<HtDoctor> doctors = htDoctorDao.selectByExample(doctorExample); |
|
|
|
log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors)); |
|
|
|
// HtDoctorExample doctorExample = new HtDoctorExample();
|
|
|
|
// doctorExample.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS).andIsDelEqualTo(Constant.Ht.NUMBER_DEFAULT);
|
|
|
|
// List<HtDoctor> doctors = htDoctorDao.selectByExample(doctorExample);
|
|
|
|
// log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors));
|
|
|
|
// 获取医生ID和病人ID
|
|
|
|
Long patientId = null; |
|
|
|
Long doctorId = null; |
|
|
|
if (query.getPatientId() != null) { |
|
|
|
patientId = query.getPatientId(); |
|
|
|
} else if (CollectionUtil.isNotEmpty(doctors)) { |
|
|
|
doctorId = doctors.get(0).getId(); |
|
|
|
// } else if (CollectionUtil.isNotEmpty(doctors)) {
|
|
|
|
// doctorId = doctors.get(0).getId();
|
|
|
|
} else { |
|
|
|
log.info("既无病人信息,有无医生信息,不允许查询"); |
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
@ -187,34 +187,32 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
//分页查询报告单列表
|
|
|
|
PageHelper.startPage(query.getPageNum(), query.getPageSize()); |
|
|
|
List<PatientReportVo.ReportName> reportVos = htPatientReportDao.queryReportName(doctorId, patientId); |
|
|
|
if (CollectionUtils.isEmpty(reportVos)) { |
|
|
|
return new PageInfo<>(reportVos); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(doctors)) { |
|
|
|
return new PageInfo<>(reportVos); |
|
|
|
} |
|
|
|
HtDoctor doctor = doctors.get(0); |
|
|
|
//查询下属职务
|
|
|
|
List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId()); |
|
|
|
reportVos.forEach(reportVo -> { |
|
|
|
|
|
|
|
//自己的可见详情
|
|
|
|
if (doctor.getId().equals(reportVo.getDoctorId())) { |
|
|
|
reportVo.setAuthority((byte)1); |
|
|
|
} else if (CollectionUtils.isEmpty(lowerPositionIds)) { |
|
|
|
reportVo.setAuthority((byte)0); |
|
|
|
} else { |
|
|
|
HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(reportVo.getDoctorId()); |
|
|
|
//自己下属的可见详情
|
|
|
|
if (lowerPositionIds.contains(reportDoctor.getPositionId())) { |
|
|
|
reportVo.setAuthority((byte)1); |
|
|
|
} else { |
|
|
|
reportVo.setAuthority((byte)0); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
// if (CollectionUtils.isEmpty(reportVos)) {
|
|
|
|
// return new PageInfo<>(reportVos);
|
|
|
|
// }
|
|
|
|
// if (CollectionUtil.isEmpty(doctors)) {
|
|
|
|
// return new PageInfo<>(reportVos);
|
|
|
|
// }
|
|
|
|
// HtDoctor doctor = doctors.get(0);
|
|
|
|
// //查询下属职务
|
|
|
|
// List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId());
|
|
|
|
// reportVos.forEach(reportVo -> {
|
|
|
|
//
|
|
|
|
// //自己的可见详情
|
|
|
|
// if (doctor.getId().equals(reportVo.getDoctorId())) {
|
|
|
|
// reportVo.setAuthority((byte)1);
|
|
|
|
// } else if (CollectionUtils.isEmpty(lowerPositionIds)) {
|
|
|
|
// reportVo.setAuthority((byte)0);
|
|
|
|
// } else {
|
|
|
|
// HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(reportVo.getDoctorId());
|
|
|
|
// //自己下属的可见详情
|
|
|
|
// if (lowerPositionIds.contains(reportDoctor.getPositionId())) {
|
|
|
|
// reportVo.setAuthority((byte)1);
|
|
|
|
// } else {
|
|
|
|
// reportVo.setAuthority((byte)0);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
return new PageInfo<>(reportVos); |
|
|
|
} |
|
|
|
|
|
|
|