|
|
@ -112,39 +112,39 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
return CodeEnum.PARAM_ERROR; |
|
|
|
} |
|
|
|
//查询修改医生信息
|
|
|
|
HtDoctorExample example = new HtDoctorExample(); |
|
|
|
example.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS); |
|
|
|
List<HtDoctor> doctors = htDoctorDao.selectByExample(example); |
|
|
|
if (CollectionUtils.isEmpty(doctors)) { |
|
|
|
log.info("{}医生信息尚未审核通过"); |
|
|
|
return CodeEnum.AUDIT_NOT_PASS; |
|
|
|
} |
|
|
|
HtDoctor doctor = doctors.get(0); |
|
|
|
|
|
|
|
//判断该报告单是否为该医生的
|
|
|
|
HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(htPatientReport.getDoctorId()); |
|
|
|
// 上级医生和报告单医生允许修改
|
|
|
|
List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId()); |
|
|
|
if (!doctor.getId().equals(reportDoctor.getId()) && !lowerPositionIds.contains(reportDoctor.getPositionId())) { |
|
|
|
log.info("不具备修改权限"); |
|
|
|
return CodeEnum.REPORT_DOCTOR_ERROR; |
|
|
|
} |
|
|
|
|
|
|
|
//记录病人的随访记录
|
|
|
|
if (StrUtil.isEmpty(htPatientReport.getInitialImpression())) { |
|
|
|
//1.统计病人的报告单的总数
|
|
|
|
HtPatientReportExample patientReportExample = new HtPatientReportExample(); |
|
|
|
patientReportExample.createCriteria().andPatientIdEqualTo(htPatientReport.getPatientId()).andInitialImpressionIsNotNull(); |
|
|
|
long count = htPatientReportDao.countByExample(patientReportExample); |
|
|
|
HtPatientFollowUp followUp = new HtPatientFollowUp(); |
|
|
|
followUp.setId(snowflake.nextId()); |
|
|
|
followUp.setPatientId(htPatientReport.getPatientId()); |
|
|
|
followUp.setFollowUpDatetime(new Date()); |
|
|
|
followUp.setFollowUpTimes((int)count+1); |
|
|
|
followUp.setRecorder(htPatientReport.getDoctorId()); |
|
|
|
followUp.setDiagnose(doctor.getId()); |
|
|
|
htPatientFollowUpMapper.insertSelective(followUp); |
|
|
|
} |
|
|
|
// HtDoctorExample example = new HtDoctorExample();
|
|
|
|
// example.createCriteria().andUserIdEqualTo(userId).andAuditStateEqualTo(Constant.Ht.Doctor.CHECK_SUCCESS);
|
|
|
|
// List<HtDoctor> doctors = htDoctorDao.selectByExample(example);
|
|
|
|
// if (CollectionUtils.isEmpty(doctors)) {
|
|
|
|
// log.info("{}医生信息尚未审核通过");
|
|
|
|
// return CodeEnum.AUDIT_NOT_PASS;
|
|
|
|
// }
|
|
|
|
// HtDoctor doctor = doctors.get(0);
|
|
|
|
|
|
|
|
// //判断该报告单是否为该医生的
|
|
|
|
// HtDoctor reportDoctor = htDoctorDao.selectByPrimaryKey(htPatientReport.getDoctorId());
|
|
|
|
// // 上级医生和报告单医生允许修改
|
|
|
|
// List<Long> lowerPositionIds = htPositionDao.queryAllLowerPosition(doctor.getPositionId());
|
|
|
|
// if (!doctor.getId().equals(reportDoctor.getId()) && !lowerPositionIds.contains(reportDoctor.getPositionId())) {
|
|
|
|
// log.info("不具备修改权限");
|
|
|
|
// return CodeEnum.REPORT_DOCTOR_ERROR;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //记录病人的随访记录
|
|
|
|
// if (StrUtil.isEmpty(htPatientReport.getInitialImpression())) {
|
|
|
|
// //1.统计病人的报告单的总数
|
|
|
|
// HtPatientReportExample patientReportExample = new HtPatientReportExample();
|
|
|
|
// patientReportExample.createCriteria().andPatientIdEqualTo(htPatientReport.getPatientId()).andInitialImpressionIsNotNull();
|
|
|
|
// long count = htPatientReportDao.countByExample(patientReportExample);
|
|
|
|
// HtPatientFollowUp followUp = new HtPatientFollowUp();
|
|
|
|
// followUp.setId(snowflake.nextId());
|
|
|
|
// followUp.setPatientId(htPatientReport.getPatientId());
|
|
|
|
// followUp.setFollowUpDatetime(new Date());
|
|
|
|
// followUp.setFollowUpTimes((int)count+1);
|
|
|
|
// followUp.setRecorder(htPatientReport.getDoctorId());
|
|
|
|
// followUp.setDiagnose(doctor.getId());
|
|
|
|
// htPatientFollowUpMapper.insertSelective(followUp);
|
|
|
|
// }
|
|
|
|
//修改报告单
|
|
|
|
HtPatientReport copy = patientReport.copy(); |
|
|
|
copy.setUrl(Constant.Ht.STRING_DEFAULT); |
|
|
@ -156,7 +156,7 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
HtPatientReportRecord record = new HtPatientReportRecord(); |
|
|
|
record.setId(snowflake.nextId()); |
|
|
|
record.setReportId(htPatientReport.getId()); |
|
|
|
record.setDoctorId(doctor.getId()); |
|
|
|
record.setDoctorId(userId); |
|
|
|
record.setContent(patientReport.toString()); |
|
|
|
htPatientReportRecordMapper.insertSelective(record); |
|
|
|
log.info("记录编辑日志"); |
|
|
|