|
|
@@ -3,31 +3,48 @@ package org.jeecg.modules.medical.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.modules.medical.common.bo.before.AuditAdvanceWarningAuditDetailResponse;
|
|
|
+import org.jeecg.modules.medical.common.bo.before.PatientInformationResponse;
|
|
|
+import org.jeecg.modules.medical.common.bo.mid.AuditMidDetailListResponse;
|
|
|
+import org.jeecg.modules.medical.common.bo.mid.request.AuditMidDetailListRequest;
|
|
|
+import org.jeecg.modules.medical.common.bo.mid.response.MidAuditDetailResponse;
|
|
|
+import org.jeecg.modules.medical.common.bo.mid.response.MidAuditDoctorInfo;
|
|
|
+import org.jeecg.modules.medical.common.bo.mid.response.ViolationsProjectMedicinesDetail;
|
|
|
import org.jeecg.modules.medical.entity.AdvanceWarningAuditDetail;
|
|
|
import org.jeecg.modules.medical.service.IAdvanceWarningAuditDetailService;
|
|
|
+import org.jeecg.modules.medical.service.IMidIncidentAuditDetailService;
|
|
|
+import org.jeecg.modules.medical.service.IMidIncidentAuditService;
|
|
|
import org.jeecg.modules.medical.service.IViolationAnalysisService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author yaowei
|
|
|
* @time 2023/10/18 15:23 星期三
|
|
|
- * @description '这里写类描述'
|
|
|
+ * @description '违规分析'
|
|
|
* @parentProject medical-java
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
|
|
|
|
|
|
@Autowired
|
|
|
private IAdvanceWarningAuditDetailService advanceWarningAuditDetailService;
|
|
|
+ @Autowired // 事中主要服务
|
|
|
+ private IMidIncidentAuditService midIncidentAuditService;
|
|
|
+ @Autowired // 事中审查详情服务
|
|
|
+ private IMidIncidentAuditDetailService midIncidentAuditDetailService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<AuditAdvanceWarningAuditDetailResponse> loadBeforeList(AuditAdvanceWarningAuditDetailResponse advanceWarningAuditDetail, Integer pageNo, Integer pageSize, Map<String, String[]> parameterMap) {
|
|
|
@@ -51,4 +68,89 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
|
|
|
}
|
|
|
return resultPage;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 事中审查统计
|
|
|
+ * @param request
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param parameterMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IPage<AuditMidDetailListResponse> loadMidAuditPageList(AuditMidDetailListRequest request, Integer pageNo, Integer pageSize, Map<String, String[]> parameterMap) {
|
|
|
+ Page<AuditMidDetailListResponse> page = new Page<>(pageNo, pageSize);
|
|
|
+ IPage<AuditMidDetailListResponse> resultPage = midIncidentAuditService.loadMidAuditPageList(page, request);
|
|
|
+ List<AuditMidDetailListResponse> records = resultPage.getRecords();
|
|
|
+ records.stream().map(item -> {
|
|
|
+ BigDecimal detailTotalAmt = midIncidentAuditService.statissticsErrAmtByMidAuditRecordId(item.getId());
|
|
|
+ item.setErrorRelativelyFewAmt(new BigDecimal("0.00"));
|
|
|
+ item.setErrorRelativelyManyAmt(new BigDecimal("0.00"));
|
|
|
+ if (null != detailTotalAmt) {
|
|
|
+ if (detailTotalAmt.compareTo(BigDecimal.ZERO) > 0) { // 异常金额大于0,就是多收
|
|
|
+ item.setErrorRelativelyManyAmt(detailTotalAmt);
|
|
|
+ } else if (detailTotalAmt.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+ item.setErrorRelativelyFewAmt(detailTotalAmt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return resultPage;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 事中审查统计-查看明细
|
|
|
+ * @param detailId: 详情ID
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public MidAuditDetailResponse midAuditDetail(Integer detailId) {
|
|
|
+ MidAuditDetailResponse result = new MidAuditDetailResponse();
|
|
|
+
|
|
|
+ AuditMidDetailListResponse detailInfo = midIncidentAuditService.loadViolationDetail(detailId);
|
|
|
+ if (detailInfo == null) {
|
|
|
+ log.error("找不到审查记录");
|
|
|
+ throw new JeecgBootException("找不到审查记录");
|
|
|
+ }
|
|
|
+ result.setDescription(detailInfo.getDescription());
|
|
|
+ result.setViolationLevel(detailInfo.getReminderLevel());
|
|
|
+ result.setMedicalInsRuleInfoCode(detailInfo.getMedicalInsRuleInfoCode());
|
|
|
+ // 构建违规项目/药品明细
|
|
|
+ ViolationsProjectMedicinesDetail v = new ViolationsProjectMedicinesDetail();
|
|
|
+ v.setMedicalProjectCode(detailInfo.getMedicalInsRuleInfoCode());
|
|
|
+ v.setMedicalProjectName(detailInfo.getMedicalInsRuleInfoName());
|
|
|
+ v.setMedicalInsuranceMark(detailInfo.getMedicalInsuranceMark());
|
|
|
+ v.setPrice(detailInfo.getPrice());
|
|
|
+ v.setMedicalNumber(detailInfo.getMedicalNumber());
|
|
|
+ // 处理异常多收,少收
|
|
|
+ BigDecimal detailTotalAmt = midIncidentAuditService.statissticsErrAmtByMidAuditRecordId(detailId);
|
|
|
+ v.setErrorRelativelyFewAmt(new BigDecimal("0.00"));
|
|
|
+ v.setErrorRelativelyManyAmt(new BigDecimal("0.00"));
|
|
|
+ if (null != detailTotalAmt) {
|
|
|
+ if (detailTotalAmt.compareTo(BigDecimal.ZERO) > 0) { // 异常金额大于0,就是多收
|
|
|
+ v.setErrorRelativelyManyAmt(detailTotalAmt);
|
|
|
+ } else if (detailTotalAmt.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+ v.setErrorRelativelyFewAmt(detailTotalAmt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ViolationsProjectMedicinesDetail> violationsProjectMedicinesDetails = new ArrayList<>();
|
|
|
+ violationsProjectMedicinesDetails.add(v);
|
|
|
+ result.setLists(violationsProjectMedicinesDetails);
|
|
|
+ // 构建患者信息
|
|
|
+ PatientInformationResponse patientInformationResponse =
|
|
|
+ midIncidentAuditDetailService.loadPatientInfoById(detailInfo.getMidIncidentAuditId().toString(), midIncidentAuditService);
|
|
|
+ result.setPatientInfo(patientInformationResponse);
|
|
|
+ // 构建医生信息
|
|
|
+ MidAuditDoctorInfo midAuditDoctorInfo = new MidAuditDoctorInfo();
|
|
|
+ midAuditDoctorInfo.setMedicalDeptCode(detailInfo.getMedicalDeptCode());
|
|
|
+ midAuditDoctorInfo.setMedicalDeptName(detailInfo.getMedicalDeptName());
|
|
|
+ midAuditDoctorInfo.setDoctorId(detailInfo.getDoctorId());
|
|
|
+ midAuditDoctorInfo.setDoctorName(detailInfo.getDoctorName());
|
|
|
+ midAuditDoctorInfo.setFeedbackResult(detailInfo.getFeedbackResult());
|
|
|
+ result.setDoctorInfo(midAuditDoctorInfo);
|
|
|
+ // 构建诊断信息
|
|
|
+
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|