|
@@ -10,6 +10,8 @@ import com.diagbot.aggregate.ResultStatisticsAggregate;
|
|
|
import com.diagbot.dto.*;
|
|
|
import com.diagbot.entity.*;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.QualityContent;
|
|
|
+import com.diagbot.enums.TimeContent;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.MedManagementInfoService;
|
|
@@ -20,6 +22,7 @@ import com.google.common.collect.Lists;
|
|
|
import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -35,6 +38,8 @@ import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.diagbot.enums.QualityContent.Rescue_Drug_List;
|
|
|
+
|
|
|
/**
|
|
|
* @Description:
|
|
|
* @Author:zhaops
|
|
@@ -2281,6 +2286,7 @@ public class ConsoleFacade {
|
|
|
* @return
|
|
|
*/
|
|
|
public MedQualityControlDTO getMedManageIndex(FilterVO filterVO) {
|
|
|
+ filterFacade.filterVOSet(filterVO);
|
|
|
MedQualityControlDTO medQualityControlDTO = new MedQualityControlDTO();
|
|
|
Map<String, Object> baseIndex = behospitalInfoFacade.getBaseIndex(filterVO);
|
|
|
//指标一、二、三、二十七
|
|
@@ -2291,43 +2297,72 @@ public class ConsoleFacade {
|
|
|
medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
|
|
|
//指标十八
|
|
|
filterVO.setFlagStr("1");
|
|
|
- entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
|
|
|
- medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
|
|
|
+ List<MedManageParamsDTO> medManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
|
|
|
+ medQualityControlDTO = rescueMethod(medManageParams,medQualityControlDTO,entryCountMap);
|
|
|
+
|
|
|
//指标十九
|
|
|
medQualityControlDTO = getfileSecAmount(filterVO,medQualityControlDTO, baseIndex);
|
|
|
+ //指标十四
|
|
|
+ filterVO.setFlagStr("2");
|
|
|
+ entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
|
|
|
+ medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
|
|
|
+ //指标十六
|
|
|
+ filterVO.setFlagStr("3");
|
|
|
+ entryCountMap = behospitalInfoFacade.getCountByEntry(filterVO);
|
|
|
+ medQualityControlDTO = ruleIndexMethod(filterVO,medQualityControlDTO, baseIndex, entryCountMap);
|
|
|
|
|
|
return medQualityControlDTO;
|
|
|
}
|
|
|
|
|
|
+ private MedQualityControlDTO rescueMethod(List<MedManageParamsDTO> medManageParams,MedQualityControlDTO medQualityControlDTO,Map<String, Object> entryCountMap){
|
|
|
+ List<MedManageParamsDTO> manageList= new ArrayList<>();
|
|
|
+ for (int i = 0; i < medManageParams.size(); i++) {
|
|
|
+ List<String> rescueDrugList = QualityContent.getRescue_Drug_List();
|
|
|
+ for (String str : rescueDrugList) {
|
|
|
+ if(medManageParams.get(i).getDaItemName().contains(str)){
|
|
|
+ manageList.add(medManageParams.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ //接受抢救的质控病历总数
|
|
|
+ double count = manageList.stream().map(MedManageParamsDTO::getBehospitalCode).distinct().count();
|
|
|
+ String wardRoundAmountStr = entryCountMap.get("WardRoundAmount").toString();
|
|
|
+ if(entryCountMap.containsKey("WardRoundAmount") && StringUtils.isNotEmpty(wardRoundAmountStr)){
|
|
|
+ //指标十七
|
|
|
+ DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ double WardRoundAmount = Double.parseDouble(wardRoundAmountStr);
|
|
|
+ double retData = 0d;
|
|
|
+ if(count!=0d){
|
|
|
+ retData = Double.parseDouble(df.format(WardRoundAmount * 100 / count));
|
|
|
+ }
|
|
|
+ medQualityControlDTO.setWardRoundNum(retData);
|
|
|
+ medQualityControlDTO.setWardRoundStr(retData+"%");
|
|
|
+ };
|
|
|
+ return medQualityControlDTO;
|
|
|
+ };
|
|
|
private MedQualityControlDTO ruleIndexMethod(FilterVO filterVO,MedQualityControlDTO medQualityControlDTO, Map<String, Object> baseIndex, Map<String, Object> entryCountMap){
|
|
|
- if(filterVO.getFlagStr().equals("0") && entryCountMap.containsKey("WardRoundAmount") && baseIndex.containsKey("thrMouthNum") && entryCountMap.get("WardRoundAmount").toString()!="0"){
|
|
|
+ if(filterVO.getFlagStr().equals("0") && entryCountMap.containsKey("WardRoundAmount") && baseIndex.containsKey("thrWorkNum") && ! entryCountMap.get("WardRoundAmount").toString().equals("0")){
|
|
|
//指标十七
|
|
|
- double wardRoundDo = currencyCal(baseIndex.get("thrMouthNum"), entryCountMap.get("WardRoundAmount"));
|
|
|
+ double wardRoundDo = currencyCal(baseIndex.get("thrWorkNum"), entryCountMap.get("WardRoundAmount"));
|
|
|
medQualityControlDTO.setWardRoundNum(wardRoundDo);
|
|
|
medQualityControlDTO.setWardRoundStr(wardRoundDo+"%");
|
|
|
|
|
|
};
|
|
|
- if(filterVO.getFlagStr().equals("1") && entryCountMap.containsKey("rescueNumDe") && entryCountMap.containsKey("rescueAmount") && entryCountMap.get("rescueNumDe").toString()!="0"){
|
|
|
- //指标十八
|
|
|
- double rescueDo = currencyCal(entryCountMap.get("rescueNumDe"), entryCountMap.get("rescueAmount"));
|
|
|
- medQualityControlDTO.setRescueNum(rescueDo);
|
|
|
- medQualityControlDTO.setRescueStr(rescueDo+"%");
|
|
|
- }
|
|
|
return medQualityControlDTO;
|
|
|
}
|
|
|
|
|
|
private double currencyCal(Object objFir,Object objSec){
|
|
|
- DecimalFormat df = new DecimalFormat("0.0");
|
|
|
+ DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
double firDouble = Double.parseDouble(objFir.toString()) - Double.parseDouble(objSec.toString());
|
|
|
- double thrMouthNum = Double.parseDouble(objFir.toString());
|
|
|
- double retData = Double.parseDouble(df.format(firDouble * 100 / thrMouthNum));
|
|
|
+ double thrWorkNum = Double.parseDouble(objFir.toString());
|
|
|
+ double retData = Double.parseDouble(df.format(firDouble * 100 / thrWorkNum));
|
|
|
return retData;
|
|
|
};
|
|
|
|
|
|
private MedQualityControlDTO getfileSecAmount(FilterVO filterVO,MedQualityControlDTO medQualityControlDTO, Map<String, Object> baseIndex){
|
|
|
QueryWrapper<BehospitalInfo> query = new QueryWrapper<>();
|
|
|
- DecimalFormat df = new DecimalFormat("0.0");
|
|
|
+ DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
query.eq("hospital_id", filterVO.getHospitalId())
|
|
|
.eq("is_deleted", IsDeleteEnum.N)
|
|
|
// .eq("is_placefile", filterVO.getIsPlacefile())
|
|
@@ -2338,15 +2373,15 @@ public class ConsoleFacade {
|
|
|
Iterator<BehospitalInfo> iterator = list.iterator();
|
|
|
while (iterator.hasNext()){
|
|
|
BehospitalInfo beh = iterator.next();
|
|
|
- Boolean flag = getTrueSecFile(beh.getBehospitalDate(), beh.getLeaveHospitalDate());
|
|
|
- //true删除元素
|
|
|
+ Boolean flag = getTrueSecFile(beh.getBehospitalDate(), beh.getLeaveHospitalDate(), TimeContent.getHolidaysTimeList());
|
|
|
+ //时间截止则删除元素
|
|
|
if(!flag){
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
double count = list.stream().distinct().map(BehospitalInfo::getBedCode).count();
|
|
|
- if(StringUtils.isNotEmpty( baseIndex.get("firMouthNum").toString()) && ! baseIndex.get("firMouthNum").toString().equals("0") ){
|
|
|
- double retNum =count* 100/Double.parseDouble(baseIndex.get("firMouthNum").toString());
|
|
|
+ if(StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString()) && ! baseIndex.get("firWorkNum").toString().equals("0") ){
|
|
|
+ double retNum =count* 100/Double.parseDouble(baseIndex.get("firWorkNum").toString());
|
|
|
double firGradeStr = Double.parseDouble(df.format(retNum));
|
|
|
medQualityControlDTO.setLeaveSecFileStr(firGradeStr+"%");
|
|
|
}
|
|
@@ -2355,96 +2390,125 @@ public class ConsoleFacade {
|
|
|
return medQualityControlDTO;
|
|
|
};
|
|
|
|
|
|
- private Boolean getTrueSecFile(Date date1,Date date2){
|
|
|
- Calendar cal1 = Calendar.getInstance();
|
|
|
- Calendar cal2 = Calendar.getInstance();
|
|
|
- //计算截止日期
|
|
|
- Calendar cal3 = Calendar.getInstance();
|
|
|
+ private Boolean getTrueSecFile(Date date1,Date date2, List<String> holidaysTimeList){
|
|
|
+ Date date = date1;
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
- DateTimeFormatter dateTimeFormatterThr = DateTimeFormatter.ofPattern("HH:mm:ss");
|
|
|
- cal1.setTime(date1);
|
|
|
- cal2.setTime(date2);
|
|
|
- cal3.setTime(date1);
|
|
|
- int holidays = 0;
|
|
|
- //确定一个 大日期
|
|
|
- if(cal1.compareTo(cal2) > 0){
|
|
|
- Calendar temp = cal1;
|
|
|
- cal1 = cal2;
|
|
|
- cal2 = temp;
|
|
|
- temp = null;
|
|
|
- }
|
|
|
- while(cal1.compareTo(cal2)<=0){
|
|
|
- //将时间卡在周六和周天时候取出周末的日期
|
|
|
- if(cal1.get(Calendar.DAY_OF_WEEK)==1||cal1.get(Calendar.DAY_OF_WEEK)==7){
|
|
|
- holidays++;
|
|
|
- System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ SimpleDateFormat simpleDateFormatRe = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar cal = null;
|
|
|
+ int count = 0;
|
|
|
+ try {
|
|
|
+ String format = simpleDateFormatRe.format(date1);
|
|
|
+ date1 = simpleDateFormatRe.parse(simpleDateFormatRe.format(date1));
|
|
|
+ date2 = simpleDateFormatRe.parse(simpleDateFormatRe.format(date2));
|
|
|
+ cal = Calendar.getInstance();
|
|
|
+ cal.setTime(date);
|
|
|
+ count = 0;
|
|
|
+ for (String str : holidaysTimeList) {
|
|
|
+ Date date3 = simpleDateFormatRe.parse(str);
|
|
|
+ if(date3.after(date1) && date3.before(date2)){
|
|
|
+ count++;
|
|
|
+ }
|
|
|
}
|
|
|
- cal1.add(Calendar.DAY_OF_YEAR,1);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- cal3.add(Calendar.DAY_OF_YEAR,holidays+2);
|
|
|
- String format1 = new SimpleDateFormat("yyyy-MM-dd").format(cal3.getTime());
|
|
|
- LocalDateTime of = LocalDateTime.of(1949, 10, 01, 16, 00,01);
|
|
|
- String format2 = of.format(dateTimeFormatterThr);
|
|
|
- String endTime = format1 +" "+ format2;
|
|
|
+ cal.add(Calendar.DAY_OF_YEAR,count+2);
|
|
|
+ String endTime = simpleDateFormat.format(cal.getTime());
|
|
|
LocalDateTime ldt = LocalDateTime.parse(endTime,dateTimeFormatter);
|
|
|
ZoneId zone = ZoneId.systemDefault();
|
|
|
Instant instant = ldt.atZone(zone).toInstant();
|
|
|
Date endDate = Date.from(instant);
|
|
|
- //true表示未截止
|
|
|
- if(endDate.after(date2)){
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
+ if(endDate.after(date2)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
private MedQualityControlDTO ManageIndexMethod(MedQualityControlDTO medQualityControlDTO, Map<String, Object> baseIndex,FilterVO filterVO){
|
|
|
+ FilterVO timeVo = new FilterVO();
|
|
|
+ BeanUtils.copyProperties(filterVO,timeVo);
|
|
|
QueryWrapper<MedManagementInfo> query = new QueryWrapper<>();
|
|
|
- DecimalFormat df = new DecimalFormat("0.0");
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ timeTrans(timeVo);
|
|
|
query.eq("hospital_id", filterVO.getHospitalId())
|
|
|
.eq("is_deleted", IsDeleteEnum.N)
|
|
|
- //指标1、2、3与是否归档没有直接关系 出院时间在单位时间内即可
|
|
|
- // .eq("is_placefile", filterVO.getIsPlacefile())
|
|
|
.isNotNull("start_date")
|
|
|
.isNotNull("end_date")
|
|
|
- .ge("start_date",filterVO.getStartDate())
|
|
|
- .le("end_date",filterVO.getEndDate());
|
|
|
+ .ge("start_date",timeVo.getStartDate())
|
|
|
+ .le("end_date",timeVo.getEndDate());
|
|
|
|
|
|
List<MedManagementInfo> list = medManagementInfoService.list(query);
|
|
|
- //单位时间同期门诊病案管理人员实际工作总月数
|
|
|
- Double firMouth = list.stream().filter(obj->obj.getPositionId()==0).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
|
|
|
+ //单位时间同期门诊病案管理人员实际工作总月数 Double =
|
|
|
+ Optional<Double> firOp = list.stream().filter(obj -> obj.getPositionId().equals("3")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
|
|
|
+ Double firMouth = 0d;
|
|
|
+ if(firOp.isPresent()){
|
|
|
+ firMouth = firOp.get();
|
|
|
+ }
|
|
|
//单位时间同期住院病案管理人员实际工作总月数
|
|
|
- Double secMouth = list.stream().filter(obj->obj.getPositionId()==1).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
|
|
|
+ Optional<Double> secOp = list.stream().filter(obj->obj.getPositionId().equals("1")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
|
|
|
+ Double secMouth = 0d;
|
|
|
+ if(secOp.isPresent()){
|
|
|
+ secMouth = secOp.get();
|
|
|
+ }
|
|
|
//单位时间同期病案编码管理人员实际工作总月数
|
|
|
- Double thrMouth = list.stream().filter(obj->obj.getPositionId()==2).map(MedManagementInfo::getWorkMouth).reduce(Double::sum).get();
|
|
|
+ Optional<Double> thrOp = list.stream().filter(obj->obj.getPositionId().equals("2")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
|
|
|
+ Double thrMouth = 0d;
|
|
|
+ if(thrOp.isPresent()){
|
|
|
+ thrMouth = thrOp.get();
|
|
|
+ }
|
|
|
Double firRecord = 0d;
|
|
|
|
|
|
//指标一
|
|
|
- if(secMouth != 0d && secMouth != null && StringUtils.isNotEmpty( baseIndex.get("firMouthNum").toString())){
|
|
|
- medQualityControlDTO.setManagerMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("firMouthNum").toString())/secMouth));
|
|
|
+ if(secMouth != 0d && secMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
|
|
|
+ medQualityControlDTO.setManagerBeNum(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString())/secMouth));
|
|
|
}
|
|
|
//指标三
|
|
|
- if(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firMouthNum").toString())){
|
|
|
- medQualityControlDTO.setCoderMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("firMouthNum").toString())/thrMouth));
|
|
|
+ if(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
|
|
|
+ medQualityControlDTO.setCoderBeNum(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString())/thrMouth));
|
|
|
}
|
|
|
|
|
|
- if(firMouth != 0d && firMouth != null && StringUtils.isNotEmpty( baseIndex.get("secMouthNum").toString())){
|
|
|
+ if(firMouth != 0d && firMouth != null && StringUtils.isNotEmpty( baseIndex.get("secWorkNum").toString())){
|
|
|
//指标二
|
|
|
- medQualityControlDTO.setSecManagerMouthNum(Math.ceil(Double.parseDouble(baseIndex.get("secMouthNum").toString())/firMouth));
|
|
|
+ medQualityControlDTO.setSecManagerBeNum(Math.ceil(Double.parseDouble(baseIndex.get("secWorkNum").toString())/firMouth));
|
|
|
}
|
|
|
|
|
|
//指标二十七 -甲级病历率
|
|
|
- if(StringUtils.isNotEmpty( baseIndex.get("forMouthNum").toString())){
|
|
|
- firRecord =Double.parseDouble(baseIndex.get("forMouthNum").toString());
|
|
|
+ if(StringUtils.isNotEmpty( baseIndex.get("forWorkNum").toString())){
|
|
|
+ firRecord =Double.parseDouble(baseIndex.get("forWorkNum").toString());
|
|
|
}
|
|
|
- if( firRecord != 0d && StringUtils.isNotEmpty( baseIndex.get("sixMouthNum").toString()) ){
|
|
|
- double retNum = Double.parseDouble(baseIndex.get("sixMouthNum").toString()) * 100 / firRecord;
|
|
|
+ if( firRecord != 0d && StringUtils.isNotEmpty( baseIndex.get("sixWorkNum").toString()) ){
|
|
|
+ double retNum = Double.parseDouble(baseIndex.get("sixWorkNum").toString()) * 100 / firRecord;
|
|
|
double firGradeStr = Double.parseDouble(df.format(retNum));
|
|
|
medQualityControlDTO.setFirGradeStr(firGradeStr+"%");
|
|
|
}
|
|
|
|
|
|
return medQualityControlDTO;
|
|
|
};
|
|
|
+ private void timeTrans(FilterVO filterVO){
|
|
|
+ SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Calendar cal1 = Calendar.getInstance();
|
|
|
+ Calendar cal2 = Calendar.getInstance();
|
|
|
+ try {
|
|
|
+ cal1.setTime(myFormatter.parse(filterVO.getStartDate()));
|
|
|
+ cal2.setTime(myFormatter.parse(filterVO.getEndDate()));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ cal1.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ cal2.set(Calendar.DAY_OF_MONTH, 1);
|
|
|
+ cal2.set(Calendar.DATE, 1);
|
|
|
+ cal2.roll(Calendar.DATE, -1);
|
|
|
+ String startTime = myFormatter.format(cal1.getTime());
|
|
|
+ startTime = startTime+" 00:00:00";
|
|
|
+ String endTime = myFormatter.format(cal2.getTime());
|
|
|
+ endTime = endTime+" 23:59:59";
|
|
|
+ filterVO.setStartDate(startTime);
|
|
|
+ filterVO.setEndDate(endTime);
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 质控核查质控评分页(内页)
|