|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.medical.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.medical.common.bo.*;
|
|
@@ -24,10 +26,7 @@ import org.jeecg.modules.medical.entity.MedicalDoctorAppealRecord;
|
|
|
import org.jeecg.modules.medical.entity.PrescriptionOrder;
|
|
|
import org.jeecg.modules.medical.mapper.AfterwardsAuditMapper;
|
|
|
import org.jeecg.modules.medical.ruleengine.projectcache.HisMedicalProjectCache;
|
|
|
-import org.jeecg.modules.medical.service.IAfterwardsAuditDetailService;
|
|
|
-import org.jeecg.modules.medical.service.IAfterwardsAuditService;
|
|
|
-import org.jeecg.modules.medical.service.IMedicalDoctorAppealRecordService;
|
|
|
-import org.jeecg.modules.medical.service.IPrescriptionOrderService;
|
|
|
+import org.jeecg.modules.medical.service.*;
|
|
|
import org.jeecg.modules.system.entity.SysDepart;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
import org.jeecg.modules.system.entity.SysUserDepart;
|
|
@@ -44,7 +43,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -73,6 +75,7 @@ public class AfterwardsAuditServiceImpl extends ServiceImpl<AfterwardsAuditMappe
|
|
|
|
|
|
private final IAfterwardsAuditDetailService afterwardsAuditDetailService;
|
|
|
private final IPrescriptionOrderService prescriptionOrderService;
|
|
|
+ private final ExportUtilHelperService exportUtilHelperService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<ReportAfterQueryResponseBO> departmentStatistics(Page<AfterwardsAudit> page, AfterwardsAudit afterwardsAudit) {
|
|
@@ -122,6 +125,41 @@ public class AfterwardsAuditServiceImpl extends ServiceImpl<AfterwardsAuditMappe
|
|
|
return auditQueryPageList;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<AfterwardsAuditExportResponse> auditQueryList(QueryWrapper<AfterwardsAudit> queryWrapper) {
|
|
|
+ List<AfterwardsAudit> dataList = this.list(queryWrapper); // TODO 待审核状态默认是空,需要查询为空
|
|
|
+ List<AfterwardsAuditExportResponse> resultList = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(dataList)) {
|
|
|
+ resultList = dataList.stream().map(item -> {
|
|
|
+ AfterwardsAuditExportResponse resultItem = new AfterwardsAuditExportResponse();
|
|
|
+ // 计算异常多收-少收
|
|
|
+/* BigDecimal detailTotalAmt = baseMapper.statisticsErrAmtByAfterwareRecordId(item.getId());
|
|
|
+ item.setErrorRelativelyFewAmt(new BigDecimal("0.00"));
|
|
|
+ item.setErrorRelativelyManyAmt(new BigDecimal("0.00"));
|
|
|
+ if (!StringUtils.hasText(item.getCheckState())) {
|
|
|
+ item.setCheckState(AfterwardsAuditStatusEnum.wait.getStatus());
|
|
|
+ }
|
|
|
+ if (null != detailTotalAmt) {
|
|
|
+ if (detailTotalAmt.compareTo(BigDecimal.ZERO) > 0) { // 异常金额大于0,就是多收
|
|
|
+ item.setErrorRelativelyManyAmt(detailTotalAmt);
|
|
|
+ } else if (detailTotalAmt.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+ item.setErrorRelativelyFewAmt(detailTotalAmt);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ int appealNumber = 0;
|
|
|
+ MedicalDoctorAppealRecord appealRecord = appealRecordService.loadMaxAppealNumber(item.getId(), item.getMedicalDeptCode(), item.getDoctorId());
|
|
|
+ if (null != appealRecord && appealRecord.getAppealNumber() != null) {
|
|
|
+ appealNumber = appealRecord.getAppealNumber();
|
|
|
+ }
|
|
|
+ item.setAuditNumber(appealNumber);
|
|
|
+ BeanUtil.copyProperties(item, resultItem);
|
|
|
+
|
|
|
+ return resultItem;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(readOnly = false)
|
|
|
@Override
|
|
|
public boolean audit(LoginUser loginUser, AuditRequestBO param) {
|
|
@@ -563,4 +601,19 @@ public class AfterwardsAuditServiceImpl extends ServiceImpl<AfterwardsAuditMappe
|
|
|
return baseMapper.statisticsAfterAuditTotal(afterwardsAuditDetail);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ModelAndView auditExportXls(HttpServletRequest req, AfterwardsAudit afterwardsAudit, Class<AfterwardsAuditExportResponse> clazz, String title) throws UnsupportedEncodingException {
|
|
|
+
|
|
|
+ String checkState = afterwardsAudit.getCheckState();
|
|
|
+ if (ObjectUtils.nullSafeEquals(AfterwardsAuditStatusEnum.wait.getStatus(),afterwardsAudit.getCheckState())) {
|
|
|
+ afterwardsAudit.setCheckState(null);
|
|
|
+ }
|
|
|
+ QueryWrapper<AfterwardsAudit> queryWrapper = QueryGenerator.initQueryWrapper(afterwardsAudit, req.getParameterMap());
|
|
|
+ if (ObjectUtils.nullSafeEquals(AfterwardsAuditStatusEnum.wait.getStatus() ,checkState)) {
|
|
|
+ queryWrapper.and(q -> q.isNull( "check_state").or().eq( "check_state", "wait"));
|
|
|
+ }
|
|
|
+ List<AfterwardsAuditExportResponse> exportList = this.auditQueryList(queryWrapper);
|
|
|
+ // 获取数据
|
|
|
+ return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
|
|
|
+ }
|
|
|
}
|