From 1bbf02f9181ffbedeaf0bdb4168a3c0d21fef2a2 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Mon, 15 Mar 2021 18:25:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=8A=A5=E5=91=8A=E5=8D=95?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=B0=86=E6=98=BE=E7=A4=BA=E5=9C=A8=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E6=8A=A5=E5=91=8A=E5=8D=95=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ht/service/PatientReportService.java | 1 + .../service/PatientReportService.java | 111 +++++++++--------- 2 files changed, 58 insertions(+), 54 deletions(-) diff --git a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java b/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java index 59c7f6c0..1c93eea0 100644 --- a/ht/src/main/java/com/ccsens/ht/service/PatientReportService.java +++ b/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(); diff --git a/question/src/main/java/com/ccsens/question/service/PatientReportService.java b/question/src/main/java/com/ccsens/question/service/PatientReportService.java index 52db1c90..cd7c61cb 100644 --- a/question/src/main/java/com/ccsens/question/service/PatientReportService.java +++ b/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 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 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 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 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 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 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 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 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 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 list = htPatientReportDao.search(param.getCodes()); return list; } + + }