|
@@ -4,7 +4,6 @@ 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.*;
|
|
@@ -15,7 +14,6 @@ import com.diagbot.enums.TimeContent;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.MedManagementInfoService;
|
|
|
-import com.diagbot.service.MedQcresultDetailService;
|
|
|
import com.diagbot.util.*;
|
|
|
import com.diagbot.vo.*;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -27,6 +25,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
@@ -75,6 +74,8 @@ public class ConsoleFacade {
|
|
|
private MedManagementInfoService medManagementInfoService;
|
|
|
@Autowired
|
|
|
private DoctorAdviceFacade doctorAdviceFacade;
|
|
|
+ @Autowired
|
|
|
+ private MedIndexResultFacade medIndexResultFacade;
|
|
|
|
|
|
//region-----------------------聚合接口开始-------------------------------
|
|
|
|
|
@@ -385,13 +386,14 @@ public class ConsoleFacade {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 病案指标
|
|
|
+ * 病案指标数据保存
|
|
|
*
|
|
|
* @param filterVO
|
|
|
* @return 2170
|
|
|
*/
|
|
|
- public List<Map<String, String>> medicalRecordIndicator(FilterVO filterVO){
|
|
|
- filterFacade.filterSet(filterVO);
|
|
|
+ @Transactional
|
|
|
+ public void saveMedicaIndicator(FilterVO filterVO){
|
|
|
+ MedIndexResult medIndexResult = new MedIndexResult();
|
|
|
String indexName = filterVO.getIndexName();
|
|
|
List<Map<String, String>> hashMapArrayList = new ArrayList<>();
|
|
|
long zz = System.currentTimeMillis();
|
|
@@ -541,65 +543,30 @@ public class ConsoleFacade {
|
|
|
/**
|
|
|
* =================================标示线========================================
|
|
|
*/
|
|
|
- long x1 = System.currentTimeMillis();
|
|
|
- System.out.println("qian" + (zz-x1));
|
|
|
+
|
|
|
Map<String, Object> baseIndex = behospitalInfoFacade.getBaseIndex(filterVO);
|
|
|
- //指标一、二、三
|
|
|
- if (QualityContent.FOURSTR.contains(indexName)||indexName.equals(QualityContent.QB)) {
|
|
|
- hashMapArrayList = ManageIndexMethod(indexName, hashMapArrayList, baseIndex, filterVO);
|
|
|
- }
|
|
|
|
|
|
//指标二十七
|
|
|
- if (indexName.equals(QualityContent.JJBLL)||indexName.equals(QualityContent.QB)) {
|
|
|
- hashMapArrayList = firMethod(indexName,hashMapArrayList,baseIndex);
|
|
|
- }
|
|
|
-
|
|
|
- long x2 = System.currentTimeMillis();
|
|
|
- System.out.println("指标一、二、三、二十七 = " + (x2-x1));
|
|
|
+ firMethod(indexName,baseIndex,medIndexResult);
|
|
|
//指标十七 医师查房记录
|
|
|
- if (indexName.equals(QualityContent.YSCF_JL_WCL)||indexName.equals(QualityContent.QB)) {
|
|
|
- hashMapArrayList = WardRoundMethod(hashMapArrayList, baseIndex, triggeringRulesMap);
|
|
|
- }
|
|
|
- long x3 = System.currentTimeMillis();
|
|
|
- System.out.println("指标十七 = " + (x3-x2));
|
|
|
+ WardRoundMethod(baseIndex, triggeringRulesMap,medIndexResult);
|
|
|
+
|
|
|
//指标十八 抢救记录
|
|
|
- if (indexName.equals(QualityContent.HZQJ_JLJS_WCL)||indexName.equals(QualityContent.QB)) {
|
|
|
- hashMapArrayList = rescueMethod(doctorAdviceMedManageParams,hashMapArrayList,triggeringRulesMap);
|
|
|
- }
|
|
|
- long x4 = System.currentTimeMillis();
|
|
|
- System.out.println("指标十八 = " + (x4-x3));
|
|
|
+ rescueMethod(doctorAdviceMedManageParams,triggeringRulesMap,medIndexResult);
|
|
|
|
|
|
//指标十九 出院患者病历2日归档
|
|
|
- if (indexName.equals(QualityContent.CCHZ_2DAY_GDL)||indexName.equals(QualityContent.QB)) {
|
|
|
- hashMapArrayList = getfileSecAmount(filterVO,hashMapArrayList, baseIndex);
|
|
|
- }
|
|
|
- long x5 = System.currentTimeMillis();
|
|
|
- System.out.println("指标十九 = " + (x5-x4));
|
|
|
+ getfileSecAmount(filterVO,baseIndex,medIndexResult);
|
|
|
|
|
|
//指标十四 手术记录
|
|
|
- if (indexName.equals(QualityContent.SS_XGJL_WCL)||indexName.equals(QualityContent.QB)) {
|
|
|
- hashMapArrayList = operationMethod(hashMapArrayList, operationFeeNum+"", triggeringRulesMap);
|
|
|
- }
|
|
|
- long x6 = System.currentTimeMillis();
|
|
|
- System.out.println("指标十四 = " + (x6-x5));
|
|
|
+ operationMethod(operationFeeNum+"", triggeringRulesMap,medIndexResult);
|
|
|
|
|
|
//指标十六 临床用血相关记录符合率
|
|
|
- if (indexName.equals(QualityContent.LCYX_XGJL_WCL)||indexName.equals(QualityContent.QB)) {
|
|
|
filterVO.setFlagStr("1");
|
|
|
List<MedManageParamsDTO> medManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
|
|
|
- long x7 = System.currentTimeMillis();
|
|
|
- System.out.println("lis查询 = " + (x7-x6));
|
|
|
- hashMapArrayList = bloodMethod(hashMapArrayList,doctorAdviceMedManageParams, medManageParams, triggeringRulesMap);
|
|
|
- long x9 = System.currentTimeMillis();
|
|
|
- System.out.println("封装 = " + (x9-x7));
|
|
|
- }
|
|
|
- long x8 = System.currentTimeMillis();
|
|
|
- System.out.println("指标十六 = " + (x8-x6));
|
|
|
- System.out.println("总耗时 = " + (x8-x1));
|
|
|
- }
|
|
|
+ bloodMethod(hashMapArrayList,doctorAdviceMedManageParams, medManageParams, triggeringRulesMap,medIndexResult);
|
|
|
|
|
|
-
|
|
|
- return hashMapArrayList;
|
|
|
+ medIndexResultFacade.save(medIndexResult);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2696,7 +2663,7 @@ public class ConsoleFacade {
|
|
|
|
|
|
|
|
|
//指标十八 抢救记录
|
|
|
- private List<Map<String, String>> rescueMethod(List<MedManageParamsDTO> medManageParams, List<Map<String, String>> retList,Map<String, Long> triggeringRulesMap){
|
|
|
+ private void rescueMethod(List<MedManageParamsDTO> medManageParams,Map<String, Long> triggeringRulesMap,MedIndexResult medIndexResult){
|
|
|
List<MedManageParamsDTO> manageList= new ArrayList<>();
|
|
|
List<String> rescueDrugList = QualityContent.RESCUEDRUGLIST;
|
|
|
for (int i = 0; i < medManageParams.size(); i++) {
|
|
@@ -2712,51 +2679,30 @@ public class ConsoleFacade {
|
|
|
|
|
|
//接受抢救的质控病历总数
|
|
|
double count = manageList.stream().map(MedManageParamsDTO::getBehospitalCode).distinct().count();
|
|
|
- String num = null;
|
|
|
if(StringUtils.isNotEmpty(String.valueOf(count)) && count != 0d){
|
|
|
double rescueDo = currencyCal(count, triggeringRulesMap.get("rescueNum"));
|
|
|
- num = String.valueOf(rescueDo);
|
|
|
- };
|
|
|
- LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
|
|
|
- firMap.put("name","患者抢救记录及时完成率");
|
|
|
- firMap.put("notCopiedStr",StringUtils.isEmpty(num)? null:(num+"%"));
|
|
|
- firMap.put("num",num);
|
|
|
- retList.add(firMap);
|
|
|
- return retList;
|
|
|
- };
|
|
|
+ medIndexResult.setRescueResult(rescueDo);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//指标十七 医师查房记录
|
|
|
- private List<Map<String, String>> WardRoundMethod( List<Map<String, String>> retList, Map<String, Object> baseIndex, Map<String, Long> triggeringRulesMap){
|
|
|
- String num = null;
|
|
|
+ private void WardRoundMethod( Map<String, Object> baseIndex, Map<String, Long> triggeringRulesMap,MedIndexResult medIndexResult){
|
|
|
if( triggeringRulesMap.containsKey("WardRoundNum") && baseIndex.containsKey("forWorkNum") && !baseIndex.get("forWorkNum").toString().equals("0")){
|
|
|
double wardRoundDo = currencyCal(baseIndex.get("forWorkNum"), triggeringRulesMap.get("WardRoundNum"));
|
|
|
- num = String.valueOf(wardRoundDo);
|
|
|
- };
|
|
|
- LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
|
|
|
- firMap.put("name","医师查房记录完成率");
|
|
|
- firMap.put("notCopiedStr",StringUtils.isEmpty(num)? null:(num+"%"));
|
|
|
- firMap.put("num",num);
|
|
|
- retList.add(firMap);
|
|
|
- return retList;
|
|
|
+ medIndexResult.setWardRoundResult(wardRoundDo);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//指标十四 手术记录
|
|
|
- private List<Map<String, String>> operationMethod( List<Map<String, String>>retList, String operationFeeNum, Map<String, Long> triggeringRulesMap){
|
|
|
- String num = null;
|
|
|
+ private void operationMethod(String operationFeeNum, Map<String, Long> triggeringRulesMap,MedIndexResult medIndexResult){
|
|
|
if( triggeringRulesMap.containsKey("operationRecordNum") && StringUtils.isNotEmpty(operationFeeNum) && ! operationFeeNum.equals("0")){
|
|
|
double operationRecordDo = currencyCal(operationFeeNum, triggeringRulesMap.get("operationRecordNum"));
|
|
|
- num = String.valueOf(operationRecordDo);
|
|
|
- };
|
|
|
- LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
|
|
|
- firMap.put("name","手术相关记录完成率");
|
|
|
- firMap.put("notCopiedStr",StringUtils.isEmpty(num)? null:(num+"%"));
|
|
|
- firMap.put("num",num);
|
|
|
- retList.add(firMap);
|
|
|
- return retList;
|
|
|
+ medIndexResult.setOperationCompleteResult(operationRecordDo);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//指标十六 临床用血相关记录符合率
|
|
|
- private List<Map<String, String>> bloodMethod( List<Map<String, String>>retList,List<MedManageParamsDTO> doctorAdviceList, List<MedManageParamsDTO> medManageParams, Map<String, Long> triggeringRulesMap){
|
|
|
+ private void bloodMethod( List<Map<String, String>>retList,List<MedManageParamsDTO> doctorAdviceList, List<MedManageParamsDTO> medManageParams, Map<String, Long> triggeringRulesMap,MedIndexResult medIndexResult){
|
|
|
Set<String> manageList= new CopyOnWriteArraySet<>();
|
|
|
List<String> blood_list = QualityContent.BLOODLIST;
|
|
|
//lis项目存在用血住院病历号
|
|
@@ -2781,18 +2727,11 @@ public class ConsoleFacade {
|
|
|
|
|
|
//临床用血的质控病历总数
|
|
|
double count = manageList.size();
|
|
|
- String num = null;
|
|
|
if(StringUtils.isNotEmpty(String.valueOf(count)) && count != 0d){
|
|
|
//指标十七
|
|
|
- double rescueDo = currencyCal(count, triggeringRulesMap.get("bloodNum"));
|
|
|
- num = String.valueOf(rescueDo);
|
|
|
- }
|
|
|
- LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
|
|
|
- firMap.put("name","临床用血相关记录符合率");
|
|
|
- firMap.put("notCopiedStr",StringUtils.isEmpty(num)? null:(num+"%"));
|
|
|
- firMap.put("num",num);
|
|
|
- retList.add(firMap);
|
|
|
- return retList;
|
|
|
+ double bloodNum = currencyCal(count, triggeringRulesMap.get("bloodNum"));
|
|
|
+ medIndexResult.setBloodResult(bloodNum);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private double currencyCal(Object objFir,Object objSec){
|
|
@@ -2804,7 +2743,7 @@ public class ConsoleFacade {
|
|
|
};
|
|
|
|
|
|
//指标十九 出院患者病历2日归档
|
|
|
- private List<Map<String, String>> getfileSecAmount(FilterVO filterVO, List<Map<String, String>>retList, Map<String, Object> baseIndex){
|
|
|
+ private void getfileSecAmount(FilterVO filterVO,Map<String, Object> baseIndex,MedIndexResult medIndexResult){
|
|
|
QueryWrapper<BehospitalInfo> query = new QueryWrapper<>();
|
|
|
DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
query.eq("hospital_id", filterVO.getHospitalId())
|
|
@@ -2826,19 +2765,12 @@ public class ConsoleFacade {
|
|
|
}
|
|
|
}
|
|
|
double count = list.stream().distinct().map(BehospitalInfo::getBedCode).count();
|
|
|
- String num = null;
|
|
|
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));
|
|
|
- num = String.valueOf(firGradeStr);
|
|
|
+ medIndexResult.setSecFileResult(firGradeStr);
|
|
|
}
|
|
|
- LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
|
|
|
- firMap.put("name","出院患者病历2日归档率");
|
|
|
- firMap.put("notCopiedStr",StringUtils.isEmpty(num)? null:(num+"%"));
|
|
|
- firMap.put("num",num);
|
|
|
- retList.add(firMap);
|
|
|
- return retList;
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
private Boolean getTrueSecFile(Date date1,Date date2, List<String> holidaysTimeList){
|
|
|
Date date = date1;
|
|
@@ -2875,100 +2807,18 @@ public class ConsoleFacade {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private List<Map<String, String>> ManageIndexMethod(String indexName,List<Map<String, String>> retList, Map<String, Object> baseIndex,FilterVO filterVO){
|
|
|
- FilterVO timeVo = new FilterVO();
|
|
|
- BeanUtils.copyProperties(filterVO,timeVo);
|
|
|
- QueryWrapper<MedManagementInfo> query = new QueryWrapper<>();
|
|
|
- timeTrans(timeVo);
|
|
|
- query.eq("hospital_id", filterVO.getHospitalId())
|
|
|
- .eq("is_deleted", IsDeleteEnum.N)
|
|
|
- .isNotNull("start_date")
|
|
|
- .isNotNull("end_date")
|
|
|
- .ge("start_date",timeVo.getStartDate())
|
|
|
- .le("end_date",timeVo.getEndDate())
|
|
|
- .select("position_id","work_person");
|
|
|
- List<MedManagementInfo> list = medManagementInfoService.list(query);
|
|
|
- //单位时间同期门诊病案管理人员实际工作总月数
|
|
|
- if(indexName.equals(QualityContent.MZBA_CYHZ)||indexName.equals(QualityContent.QB)) {
|
|
|
- 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();
|
|
|
- }
|
|
|
- String num3= null;
|
|
|
- if(firMouth != 0d && firMouth != null && StringUtils.isNotEmpty( baseIndex.get("secWorkNum").toString())){
|
|
|
- //指标二
|
|
|
- num3 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("secWorkNum").toString())/firMouth));
|
|
|
- }
|
|
|
- LinkedHashMap<String, String> thrMap = new LinkedHashMap<>();
|
|
|
- thrMap.put("name","门诊病案管理人员月均负担门诊患者病历数");
|
|
|
- thrMap.put("num",num3);
|
|
|
- retList.add(thrMap);
|
|
|
- }
|
|
|
-
|
|
|
- //单位时间同期住院病案管理人员实际工作总月数
|
|
|
- if(indexName.equals(QualityContent.ZYBA_CYHZ)||indexName.equals(QualityContent.QB)) {
|
|
|
- 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();
|
|
|
- }
|
|
|
- //指标一
|
|
|
- String num1 = null;
|
|
|
- if(secMouth != 0d && secMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
|
|
|
- num1 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString()) / secMouth));
|
|
|
- }
|
|
|
- LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
|
|
|
- firMap.put("name","住院病案管理人员月均负担出院患者病历数");
|
|
|
- firMap.put("num",num1);
|
|
|
- retList.add(firMap);
|
|
|
- }
|
|
|
-
|
|
|
- //单位时间同期病案编码管理人员实际工作总月数
|
|
|
- if(indexName.equals(QualityContent.BABM_CYHZ)||indexName.equals(QualityContent.QB)) {
|
|
|
- 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();
|
|
|
- }
|
|
|
-
|
|
|
- //指标三
|
|
|
- String num2 = null;
|
|
|
- if(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
|
|
|
- num2 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString())/thrMouth));
|
|
|
-
|
|
|
- }
|
|
|
- LinkedHashMap<String, String> secMap = new LinkedHashMap<>();
|
|
|
- secMap.put("name","病案编码人员月均负担出院患者病历数");
|
|
|
- secMap.put("num",num2);
|
|
|
- retList.add(secMap);
|
|
|
- }
|
|
|
- return retList;
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
- private List<Map<String, String>> firMethod(String indexName,List<Map<String, String>> retList, Map<String, Object> baseIndex){
|
|
|
+ private void firMethod(String indexName, Map<String, Object> baseIndex, MedIndexResult medIndexResult){
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- if(indexName.equals(QualityContent.JJBLL)||indexName.equals(QualityContent.QB)) {
|
|
|
- //指标二十七 -甲级病历率
|
|
|
+ //指标二十七 -甲级病历率
|
|
|
Double firRecord = 0d;
|
|
|
- String num4= null;
|
|
|
if(StringUtils.isNotEmpty( baseIndex.get("forWorkNum").toString())){
|
|
|
firRecord =Double.parseDouble(baseIndex.get("forWorkNum").toString());
|
|
|
}
|
|
|
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));
|
|
|
- num4 = String.valueOf(Math.ceil(firGradeStr));
|
|
|
+ medIndexResult.setFirRecordResult(firGradeStr);
|
|
|
}
|
|
|
- LinkedHashMap<String, String> fouMap = new LinkedHashMap<>();
|
|
|
- fouMap.put("name","甲级病历率");
|
|
|
- fouMap.put("notCopiedStr",StringUtils.isEmpty(num4)? null:(num4+"%"));
|
|
|
- fouMap.put("num",num4);
|
|
|
- retList.add(fouMap);
|
|
|
- }
|
|
|
- return retList;
|
|
|
};
|
|
|
|
|
|
private void timeTrans(FilterVO filterVO){
|