|
@@ -4,14 +4,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.diagbot.aggregate.AverageStatisticsAggregate;
|
|
|
+import com.diagbot.aggregate.LeaveHosStatisticsAggregate;
|
|
|
import com.diagbot.aggregate.MrStatisticsAggregate;
|
|
|
import com.diagbot.aggregate.ResultStatisticsAggregate;
|
|
|
import com.diagbot.dto.*;
|
|
|
+import com.diagbot.entity.MedManagementInfo;
|
|
|
import com.diagbot.entity.QcCasesEntry;
|
|
|
import com.diagbot.entity.SysHospitalSet;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.service.MedManagementInfoService;
|
|
|
import com.diagbot.util.*;
|
|
|
import com.diagbot.vo.*;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -19,11 +22,17 @@ import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.validation.Path;
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.DecimalFormat;
|
|
|
+import java.time.Duration;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -55,6 +64,11 @@ public class ConsoleFacade {
|
|
|
private SysHospitalSetFacade sysHospitalSetFacade;
|
|
|
@Autowired
|
|
|
private QcCasesEntryFacade qcCasesEntryFacade;
|
|
|
+ @Autowired
|
|
|
+ private LeaveHosStatisticsAggregate leaveHosStatisticsAggregate;
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("medManagementInfoServiceImpl")
|
|
|
+ private MedManagementInfoService medManagementInfoService;
|
|
|
|
|
|
//region-----------------------聚合接口开始-------------------------------
|
|
|
|
|
@@ -363,6 +377,128 @@ public class ConsoleFacade {
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 住院病案管理人员月均负担出院患者病历
|
|
|
+ * @param filterVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public double hospitalMonthly(FilterVO filterVO) {
|
|
|
+ //获取出院总人数
|
|
|
+ Integer totleCount = leaveHosStatisticsAggregate.getTotleCount(filterVO);
|
|
|
+ //获取病案管理人员工作
|
|
|
+ List<MedManagementInfo> list = medManagementInfoService.list();
|
|
|
+ String startDate = filterVO.getStartDate();
|
|
|
+ String endDate = filterVO.getEndDate();
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime sta = LocalDateTime.parse(startDate,df);
|
|
|
+ LocalDateTime end = LocalDateTime.parse(endDate,df);
|
|
|
+ //病案管理月均
|
|
|
+ int position=1;
|
|
|
+ long timeCount = getTimeCount(list, sta, end,position);
|
|
|
+ //多少月
|
|
|
+ double monthlyInt= 0;
|
|
|
+ try {
|
|
|
+ double timeMonth=timeCount/30;
|
|
|
+ // 住院病案管理人员月均负担出院患者病历
|
|
|
+ monthlyInt = ((double) totleCount.intValue()/timeMonth);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ //throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历无关联的质控条目!");
|
|
|
+ }
|
|
|
+ return monthlyInt;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 病案编码管理人员月均负担出院患者病历
|
|
|
+ * @param filterVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public double codingMonthly(FilterVO filterVO) {
|
|
|
+ Integer totleCount = leaveHosStatisticsAggregate.getTotleCount(filterVO);
|
|
|
+ List<MedManagementInfo> list = medManagementInfoService.list();
|
|
|
+ String startDate = filterVO.getStartDate();
|
|
|
+ String endDate = filterVO.getEndDate();
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime sta = LocalDateTime.parse(startDate,df);
|
|
|
+ LocalDateTime end = LocalDateTime.parse(endDate,df);
|
|
|
+ int position=2;
|
|
|
+ long timeCount = getTimeCount(list, sta, end,position);
|
|
|
+ double monthlyInt= 0;
|
|
|
+ try {
|
|
|
+ double timeMonth=timeCount/30;
|
|
|
+ monthlyInt = ((double) totleCount.intValue()/timeMonth);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return monthlyInt;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public long getTimeCount(List<MedManagementInfo> list,LocalDateTime sta,LocalDateTime end,int positionInt) {
|
|
|
+ long timeCount = 0;
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ for (MedManagementInfo managementInfo : list) {
|
|
|
+ if (positionInt == managementInfo.getPosition()) {
|
|
|
+ LocalDateTime hireDate = managementInfo.getHireDate();
|
|
|
+ LocalDateTime resignationTime = managementInfo.getResignationTime();
|
|
|
+ //开始工作时间和离职时间均不为空
|
|
|
+ if (hireDate != null && resignationTime != null) {
|
|
|
+ //单位时间内开始时间大于等于工作时间且结束时间大于等于离职时间
|
|
|
+ if ((sta.isAfter(hireDate) || sta.equals(hireDate)) && (end.isAfter(resignationTime) || end.equals(resignationTime))) {
|
|
|
+ // 开始时间---离职时间 相差的天数
|
|
|
+ Duration duration = Duration.between(sta, resignationTime);
|
|
|
+ long days = duration.toDays();
|
|
|
+ timeCount = timeCount + days;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //单位时间内开始时间大于等于工作时间且离职时间大于等于结束时间
|
|
|
+ if ((sta.isAfter(hireDate) || sta.equals(hireDate)) && (resignationTime.isAfter(end) || end.equals(resignationTime))) {
|
|
|
+ // 开始时间---结束时间
|
|
|
+ Duration duration = Duration.between(sta, end);
|
|
|
+ long days = duration.toDays();
|
|
|
+ timeCount = timeCount + days;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 开始时间< =工作时间 离职时间<=结束时间
|
|
|
+ if ((hireDate.isAfter(sta) || sta.equals(hireDate)) && (end.isAfter(resignationTime) || end.equals(resignationTime))) {
|
|
|
+ // 结束时间 ---离职时间
|
|
|
+ Duration duration = Duration.between(hireDate, resignationTime);
|
|
|
+ long days = duration.toDays();
|
|
|
+ timeCount = timeCount + days;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 开始时间<=工作时间 离职时间>=结束时间
|
|
|
+ if ((hireDate.isAfter(sta) || sta.equals(hireDate)) && (resignationTime.isAfter(end) || end.equals(resignationTime))) {
|
|
|
+ // 工作时间---结束时间
|
|
|
+ Duration duration = Duration.between(hireDate, end);
|
|
|
+ long days = duration.toDays();
|
|
|
+ timeCount = timeCount + days;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //离职时间为空
|
|
|
+ if (hireDate != null && resignationTime == null) {
|
|
|
+ //开始时间<=工作时间
|
|
|
+ if (hireDate.isAfter(sta) || sta.equals(hireDate)) {
|
|
|
+ Duration duration = Duration.between(hireDate, end);
|
|
|
+ long days = duration.toDays();
|
|
|
+ timeCount = timeCount + days;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 开始时间>=工作时间
|
|
|
+ if (sta.isAfter(hireDate) || sta.equals(hireDate)) {
|
|
|
+ Duration duration = Duration.between(sta, end);
|
|
|
+ long days = duration.toDays();
|
|
|
+ timeCount = timeCount + days;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return timeCount;
|
|
|
+ }
|
|
|
/**
|
|
|
* 质控病历统计
|
|
|
*
|