|
|
@ -17,6 +17,7 @@ import com.ccsens.ht.persist.dao.*; |
|
|
|
import com.ccsens.ht.persist.mapper.HtPatientFollowUpMapper; |
|
|
|
import com.ccsens.ht.persist.mapper.HtPatientMapper; |
|
|
|
import com.ccsens.ht.persist.mapper.HtPatientReportRecordMapper; |
|
|
|
import com.ccsens.ht.persist.mapper.HtReportRelevanceMapper; |
|
|
|
import com.ccsens.ht.uitl.Constant; |
|
|
|
import com.ccsens.util.*; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
@ -71,6 +72,8 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
private HtQuestionDao htQuestionDao; |
|
|
|
@Resource |
|
|
|
private IQuestionService questionService; |
|
|
|
@Resource |
|
|
|
private HtReportRelevanceMapper reportRelevanceMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public JsonResponse<PatientReportVo.Generate> generatePatientReport(PatientReportDto.Generate generate, Long userId) { |
|
|
@ -136,9 +139,14 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
log.info("不具备修改权限"); |
|
|
|
return CodeEnum.REPORT_DOCTOR_ERROR; |
|
|
|
} |
|
|
|
|
|
|
|
//查找初步印象,三个报告单有一个就可以,全部都没有则记录病人的随访记录
|
|
|
|
HtReportRelevanceExample relevanceExample = new HtReportRelevanceExample(); |
|
|
|
relevanceExample.createCriteria().andReportCodeEqualTo(patientReport.getReport()) |
|
|
|
.andReportIdEqualTo(patientReport.getId()).andImpressionIsNotNull(); |
|
|
|
long l = reportRelevanceMapper.countByExample(relevanceExample); |
|
|
|
//记录病人的随访记录
|
|
|
|
if (StrUtil.isEmpty(htPatientReport.getInitialImpression())) { |
|
|
|
// if (StrUtil.isEmpty(htPatientReport.getInitialImpression())) {
|
|
|
|
if(l <= 0) { |
|
|
|
//1.统计病人的报告单的总数
|
|
|
|
HtPatientReportExample patientReportExample = new HtPatientReportExample(); |
|
|
|
patientReportExample.createCriteria().andPatientIdEqualTo(htPatientReport.getPatientId()).andInitialImpressionIsNotNull(); |
|
|
@ -151,6 +159,26 @@ public class PatientReportService implements IPatientReportService { |
|
|
|
followUp.setRecorder(htPatientReport.getDoctorId()); |
|
|
|
followUp.setDiagnose(doctor.getId()); |
|
|
|
htPatientFollowUpMapper.insertSelective(followUp); |
|
|
|
// }
|
|
|
|
} |
|
|
|
//查找当前报告单类型的关联
|
|
|
|
HtReportRelevanceExample relevanceExample1 = new HtReportRelevanceExample(); |
|
|
|
relevanceExample1.createCriteria().andReportCodeEqualTo(patientReport.getReport()) |
|
|
|
.andReportIdEqualTo(patientReport.getId()); |
|
|
|
List<HtReportRelevance> htReportRelevances = reportRelevanceMapper.selectByExample(relevanceExample1); |
|
|
|
HtReportRelevance reportRelevance = new HtReportRelevance(); |
|
|
|
if(CollectionUtil.isNotEmpty(htReportRelevances)){ |
|
|
|
reportRelevance = htReportRelevances.get(0); |
|
|
|
reportRelevance.setImpression(patientReport.getInitialImpression()); |
|
|
|
reportRelevance.setSocre(patientReport.getWorkingScore()); |
|
|
|
reportRelevanceMapper.updateByPrimaryKeySelective(reportRelevance); |
|
|
|
}else { |
|
|
|
reportRelevance.setId(snowflake.nextId()); |
|
|
|
reportRelevance.setReportId(patientReport.getId()); |
|
|
|
reportRelevance.setReportCode(patientReport.getReport()); |
|
|
|
reportRelevance.setImpression(patientReport.getInitialImpression()); |
|
|
|
reportRelevance.setSocre(patientReport.getWorkingScore()); |
|
|
|
reportRelevanceMapper.insertSelective(reportRelevance); |
|
|
|
} |
|
|
|
//修改报告单
|
|
|
|
HtPatientReport copy = patientReport.copy(); |
|
|
|