|
|
@ -69,33 +69,33 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
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.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(); |
|
|
|