|
|
@@ -6,7 +6,9 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.modules.medical.common.bo.before.*;
|
|
|
import org.jeecg.modules.medical.entity.AdvanceWarningAudit;
|
|
|
+import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
|
|
|
import org.jeecg.modules.medical.mapper.AdvanceWarningAuditMapper;
|
|
|
+import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
|
|
|
import org.jeecg.modules.medical.service.IAdvanceWarningAuditService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -31,22 +33,44 @@ import java.util.List;
|
|
|
*/
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
-public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAuditMapper, AdvanceWarningAudit> implements IAdvanceWarningAuditService {
|
|
|
+public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAuditMapper, AdvanceWarningAudit>
|
|
|
+ implements IAdvanceWarningAuditService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public PatientInformationResponse loadPatientInfoById(String id) {
|
|
|
+ public PatientInformationResponse loadPatientInfoById(String id, IAdvanceWarningAuditDetailService iAdvanceWarningAuditDetailService) {
|
|
|
AdvanceWarningAudit advanceWarningAudit = this.getById(id);
|
|
|
if (advanceWarningAudit == null) {
|
|
|
log.error("找不到事前工单id={}", id);
|
|
|
throw new JeecgBootException("找不到工单id");
|
|
|
}
|
|
|
PatientInformationResponse result = baseMapper.loadPatientInfoById(id);
|
|
|
+ if (null != result) {
|
|
|
+ //查一次就诊流水号
|
|
|
+ List<AdvanceWarningAuditDetail> detailList = iAdvanceWarningAuditDetailService.loadAdvanceWarningAuditDetail(id);
|
|
|
+ if (!CollectionUtils.isEmpty(detailList)) {
|
|
|
+ AdvanceWarningAuditDetail advanceWarningAuditDetail = detailList.get(0);
|
|
|
+ String outpatientNumber = advanceWarningAuditDetail.getOutpatientNumber();
|
|
|
+ result.setVisitSerialNumber(outpatientNumber);
|
|
|
+ result.setMedicalInsurance(advanceWarningAuditDetail.getMedicalInsuranceMark());
|
|
|
+ }
|
|
|
+ //计算患者年龄
|
|
|
+ Date birthday = result.getBirthday();
|
|
|
+ if (null != birthday) {
|
|
|
+
|
|
|
+ Instant instant = birthday.toInstant();
|
|
|
+ LocalDate usageLocalDate = instant.atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ // 获取两个日期天数相差
|
|
|
+ long until = usageLocalDate.until(now, ChronoUnit.YEARS) + 1;
|
|
|
+ result.setAge(String.valueOf(until));
|
|
|
+ }
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<MedicalHistoryRecord> queryMedicalHistoryRecords(Page<MedicalHistoryRecord> page, String id) {
|
|
|
+ public IPage<MedicalHistoryRecord> queryMedicalHistoryRecords(Page<MedicalHistoryRecord> page, String id, IAdvanceWarningAuditDetailService iAdvanceWarningAuditDetailService) {
|
|
|
// 先查询主单,获取到患者信息
|
|
|
AdvanceWarningAudit advanceWarningAudit = this.getById(id);
|
|
|
if (advanceWarningAudit == null) {
|
|
|
@@ -65,6 +89,12 @@ public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAu
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
String startTime = localDateTime.format(dateTimeFormatter);
|
|
|
|
|
|
+ AdvanceWarningAuditDetail advanceWarningAuditDetail = null;
|
|
|
+ //查询详情中的标题信息
|
|
|
+ List<AdvanceWarningAuditDetail> detailList = iAdvanceWarningAuditDetailService.detailList(id);
|
|
|
+ if (!CollectionUtils.isEmpty(detailList)) {
|
|
|
+ advanceWarningAuditDetail = detailList.get(0);
|
|
|
+ }
|
|
|
|
|
|
IPage<MedicalHistoryRecord> result = baseMapper.queryMedicalHistoryRecords(page, patientId, startTime);
|
|
|
// 查询子表,获取总费用,医保费用,以及个人费用
|
|
|
@@ -87,6 +117,10 @@ public class AdvanceWarningAuditServiceImpl extends ServiceImpl<AdvanceWarningAu
|
|
|
record.setFundPayAmount(mr.getFundPayAmount());
|
|
|
record.setPersonalPayAmt(mr.getPersonalPayAmt());
|
|
|
}
|
|
|
+ if (advanceWarningAuditDetail != null) {
|
|
|
+ record.setRuleName(advanceWarningAuditDetail.getMedicalInsRuleInfoName());
|
|
|
+ record.setDescription(advanceWarningAuditDetail.getDescription());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
result.setRecords(records);
|