|
@@ -14,7 +14,7 @@ import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.BehospitalInfoServiceImpl;
|
|
|
-import com.diagbot.service.impl.MedQcresultDetailServiceImpl;
|
|
|
+import com.diagbot.service.impl.QcresultDetailServiceImpl;
|
|
|
import com.diagbot.service.impl.StrInformedConsentServiceImpl;
|
|
|
import com.diagbot.util.*;
|
|
|
import com.diagbot.vo.*;
|
|
@@ -22,7 +22,9 @@ import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
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.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -150,7 +152,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
@Autowired
|
|
|
SysUserRoleFacade sysUserRoleFacade;
|
|
|
@Autowired
|
|
|
- MedQcresultDetailServiceImpl medQcresultDetailService;
|
|
|
+ QcresultDetailFacade qcresultDetailFacade;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -2295,9 +2297,10 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
String isPlacefile) {
|
|
|
Long hospitalId = analyzeVO.getHospitalId();
|
|
|
List<QcResultAlgVO> qcResultAlgVOList = new ArrayList<>();
|
|
|
- //获取本用户原手动添加的扣分条目
|
|
|
- List<Long> casesEntryIds = addQcDetailHistory(analyzeVO, codeList);
|
|
|
-
|
|
|
+ //获取本用户原手动添加的扣分条目(删除|未删除)
|
|
|
+ List<QcCasesEntry> qcCasesEntryHistory = new ArrayList<>();
|
|
|
+ List<QcresultDetail> qcresultDetails = getQcDetailHistory(analyzeVO, codeList,qcCasesEntryHistory);
|
|
|
+ Map<Long,List<QcCasesEntry>> qcCasesEntryHistoryMap = qcCasesEntryHistory.stream().collect(Collectors.groupingBy(QcCasesEntry::getId));
|
|
|
if (ListUtil.isNotEmpty(codeList)) {
|
|
|
// 根据质控结果获取质控条目
|
|
|
QcResultAlgQueryVO qcResultAlgQueryVO = new QcResultAlgQueryVO();
|
|
@@ -2314,6 +2317,23 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
bean.setInfo(info);
|
|
|
}
|
|
|
}
|
|
|
+ //1.1未删除的手工评分
|
|
|
+ List<QcresultDetail> notDelQcDetailHistory = qcresultDetails.stream()
|
|
|
+ .filter(qcresultDetail -> "N".equals(qcresultDetail.getIsDeleted())).collect(Collectors.toList());
|
|
|
+ List<QcResultAlgVO> rgQcResultAlgVOList = new ArrayList<>();
|
|
|
+ if(ListUtil.isNotEmpty(notDelQcDetailHistory)){
|
|
|
+ notDelQcDetailHistory.stream().forEach(qcresultDetail -> {
|
|
|
+ QcResultAlgVO temp = new QcResultAlgVO();
|
|
|
+ BeanUtils.copyProperties(qcresultDetail,temp);
|
|
|
+ try{
|
|
|
+ temp.setCode(qcCasesEntryHistoryMap.get(qcresultDetail.getCasesEntryId()).get(0).getCode());
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ rgQcResultAlgVOList.add(temp);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ qcResultAlgVOList.addAll(rgQcResultAlgVOList);
|
|
|
|
|
|
// 评分
|
|
|
AlgorithmVO algorithmVO = new AlgorithmVO();
|
|
@@ -2395,18 +2415,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
String menuData = JSON.toJSONString(qcModeDTOList);
|
|
|
|
|
|
// 保存评分结果信息
|
|
|
- //删除原手工扣分条目
|
|
|
- if(ListUtil.isNotEmpty(casesEntryIds)){
|
|
|
- if(ListUtil.isNotEmpty(algorithmVO.getQcResultAlgVOList())){
|
|
|
- List<QcResultAlgVO> qcResultAlgVOListTemp = new ArrayList<>();
|
|
|
- algorithmVO.getQcResultAlgVOList().stream().forEach(qcResultAlgVO -> {
|
|
|
- if(!casesEntryIds.contains(qcResultAlgVO.getCasesEntryId())){
|
|
|
- qcResultAlgVOListTemp.add(qcResultAlgVO);
|
|
|
- }
|
|
|
- });
|
|
|
- algorithmVO.setQcResultAlgVOList(qcResultAlgVOListTemp);
|
|
|
- }
|
|
|
- }
|
|
|
+ //计分删除人工添加条目
|
|
|
+ algorithmVO.getQcResultAlgVOList().removeAll(rgQcResultAlgVOList);
|
|
|
Date date = qcresultInfoFacade.saveQcResult(algorithmDTO, algorithmVO, analyzeVO, pageData, menuData, analyzeVO.getIsTask(), null);
|
|
|
|
|
|
// 返回结果信息
|
|
@@ -2419,30 +2429,44 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
|
|
|
/**
|
|
|
* @param analyzeVO
|
|
|
* @param codeList
|
|
|
- * @Description添加原手动扣分分值条目
|
|
|
+ * @Description获取原手动扣分分值条目
|
|
|
* @Return void
|
|
|
*/
|
|
|
- private List<Long> addQcDetailHistory(AnalyzeVO analyzeVO, List<String> codeList) {
|
|
|
+ private List<QcresultDetail> getQcDetailHistory(AnalyzeVO analyzeVO, List<String> codeList,List<QcCasesEntry> qcCasesEntryHistory) {
|
|
|
+ List<QcresultDetail> qcresultDetails = null;
|
|
|
try {
|
|
|
- List<Long> qcDetailIDHistory = medQcresultDetailService.list(new QueryWrapper<MedQcresultDetail>()
|
|
|
+ QcresultInfo qcresultInfoup
|
|
|
+ = qcresultInfoFacade.getOne(
|
|
|
+ new QueryWrapper<QcresultInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("hospital_id", analyzeVO.getHospitalId())
|
|
|
+ .eq("behospital_code", analyzeVO.getBehospitalCode()), false);
|
|
|
+ //未评过分
|
|
|
+ if(qcresultInfoup==null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //1.获取上一次评分手工添加的条目
|
|
|
+ qcresultDetails = qcresultDetailFacade.list(new QueryWrapper<QcresultDetail>()
|
|
|
.eq("hospital_id", analyzeVO.getHospitalId())
|
|
|
.eq("behospital_code", analyzeVO.getBehospitalCode())
|
|
|
.eq("grade_type", "2")
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(MedQcresultDetail::getCasesEntryId).collect(Collectors.toList());
|
|
|
+ .eq("qcresult_info_id", qcresultInfoup.getId()));
|
|
|
+ List<Long> qcDetailIDHistory = qcresultDetails.stream().map(QcresultDetail::getCasesEntryId).collect(Collectors.toList());
|
|
|
+
|
|
|
if (ListUtil.isNotEmpty(qcDetailIDHistory)) {
|
|
|
- List<String> codes = qcCasesEntryFacade.list(new QueryWrapper<QcCasesEntry>()
|
|
|
- .select("code")
|
|
|
+ List<QcCasesEntry> qcCasesEntries = qcCasesEntryFacade.list(new QueryWrapper<QcCasesEntry>()
|
|
|
+ .select("id,code")
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .in("id", qcDetailIDHistory)).stream().map(QcCasesEntry::getCode).collect(Collectors.toList());
|
|
|
- if (ListUtil.isNotEmpty(codes)) {
|
|
|
- codeList.addAll(codes);
|
|
|
+ .in("id", qcDetailIDHistory));
|
|
|
+ if (ListUtil.isNotEmpty(qcCasesEntries)) {
|
|
|
+ qcCasesEntryHistory.addAll(qcCasesEntries);
|
|
|
+ codeList.removeAll(qcCasesEntryHistory.stream().map(QcCasesEntry::getCode).collect(Collectors.toList()));
|
|
|
}
|
|
|
- return qcDetailIDHistory;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return null;
|
|
|
+ return qcresultDetails;
|
|
|
}
|
|
|
|
|
|
/**
|