Browse Source

编辑报告单时,将显示在历史报告单修改为1

sd
zhizhi wu 4 years ago
parent
commit
1bbf02f918
  1. 1
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  2. 111
      question/src/main/java/com/ccsens/question/service/PatientReportService.java

1
ht/src/main/java/com/ccsens/ht/service/PatientReportService.java

@ -150,6 +150,7 @@ public class PatientReportService implements IPatientReportService {
copy.setUrl(Constant.Ht.STRING_DEFAULT);
copy.setQrCodeUrl(Constant.Ht.STRING_DEFAULT);
copy.setCompleteStatus(Constant.Ht.Report.COMPLETE_OK);
copy.setShowStatus(Constant.Ht.Report.SHOW_HISTORY);
htPatientReportDao.updateByPrimaryKeySelective(copy);
log.info("成功编辑报告单信息");
HtPatientReportRecord record = new HtPatientReportRecord();

111
question/src/main/java/com/ccsens/question/service/PatientReportService.java

@ -25,7 +25,6 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -69,35 +68,34 @@ public class PatientReportService implements IPatientReportService {
@Override
public JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate generate, Long userId) {
log.info("生成报告单请求参数:userId:{}, patientReport:{}", userId, generate);
// //查询医生信息
// 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);
// if (CollectionUtils.isEmpty(doctors)) {
// log.info("根据userId未找到审核通过的医生信息:{}", userId);
// return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
// }
// //查询病人信息
// HtPatient htPatient = htPatientMapper.selectByPrimaryKey(generate.getPatientId());
// if (htPatient == null) {
// log.info("根据patientId未找到病友信息:{}", generate.getPatientId());
// return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
// }
//查询医生信息
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);
if (CollectionUtils.isEmpty(doctors)) {
log.info("根据userId未找到审核通过的医生信息:{}", userId);
return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
}
//查询病人信息
HtPatient htPatient = htPatientMapper.selectByPrimaryKey(generate.getPatientId());
if (htPatient == null) {
log.info("根据patientId未找到病友信息:{}", generate.getPatientId());
return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
}
HtPatientReport htPatientReport = new HtPatientReport();
htPatientReport.setId(snowflake.nextId());
// htPatientReport.setDoctorId(doctors.get(0).getId());
htPatientReport.setUserId(userId);
htPatientReport.setDoctorId(doctors.get(0).getId());
htPatientReport.setPatientId(generate.getPatientId());
// htPatientReport.setPatientIdcard(htPatient.getIdcard());
// htPatientReport.setPatientAge(StrUtil.isEmpty(htPatient.getIdcard()) ? null : (byte)IdcardUtil.getAgeByIdCard(htPatient.getIdcard()));
htPatientReport.setPatientIdcard(htPatient.getIdcard());
htPatientReport.setPatientAge(StrUtil.isEmpty(htPatient.getIdcard()) ? null : (byte)IdcardUtil.getAgeByIdCard(htPatient.getIdcard()));
htPatientReport.setEvaluationCode(Constant.Ht.Report.PARENT_CODE);
htPatientReport.setName(Constant.Ht.Report.PARENT_NAME + DateUtil.today());
htPatientReport.setReportTime(System.currentTimeMillis());
// 查询医院信息
// String hospital = htPositionDao.queryHospital(doctors.get(0).getPositionId());
// htPatientReport.setHospital(hospital);
String hospital = htPositionDao.queryHospital(doctors.get(0).getPositionId());
htPatientReport.setHospital(hospital);
htPatientReportDao.insertSelective(htPatientReport);
log.info("生成病友报告单:{}", generate);
PatientReportVo.Generate generateVo = new PatientReportVo.Generate();
@ -152,6 +150,7 @@ public class PatientReportService implements IPatientReportService {
copy.setUrl(Constant.Ht.STRING_DEFAULT);
copy.setQrCodeUrl(Constant.Ht.STRING_DEFAULT);
copy.setCompleteStatus(Constant.Ht.Report.COMPLETE_OK);
copy.setShowStatus(Constant.Ht.Report.SHOW_HISTORY);
htPatientReportDao.updateByPrimaryKeySelective(copy);
log.info("成功编辑报告单信息");
HtPatientReportRecord record = new HtPatientReportRecord();
@ -169,17 +168,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,32 +186,34 @@ 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);
}
@ -405,7 +406,7 @@ public class PatientReportService implements IPatientReportService {
dateCell.setBorderBottom(null);
dateCell.setBorderLeft(null);
content.add(row2);
log.info("导出列表:{}", content);
String path = PropUtil.imgDomain + "/" + PdfUtil.credatePdf(PropUtil.path, detail.getPatient().getHospital(), Constant.Ht.Report.PARENT_NAME, detail.getPatient().toPdfRow(), content, new PdfUtil.Margin());
report.setUrl(path);
htPatientReportDao.updateByPrimaryKeySelective(report);
@ -606,4 +607,6 @@ public class PatientReportService implements IPatientReportService {
List<PatientReportSearchVo.Search> list = htPatientReportDao.search(param.getCodes());
return list;
}
}

Loading…
Cancel
Save