|
@@ -258,6 +258,9 @@ public class ConsoleByDeptFacade {
|
|
? new HashMap<>()
|
|
? new HashMap<>()
|
|
: EntityUtil.makeEntityListMap(qcEntryNumList, "deptName");
|
|
: EntityUtil.makeEntityListMap(qcEntryNumList, "deptName");
|
|
List<NumDTO> standardEntryNumList = qcCasesFacade.entryGroupByCase();
|
|
List<NumDTO> standardEntryNumList = qcCasesFacade.entryGroupByCase();
|
|
|
|
+ Map<String, NumDTO> standardMap = ListUtil.isEmpty(standardEntryNumList)
|
|
|
|
+ ? new HashMap<>()
|
|
|
|
+ : EntityUtil.makeEntityMap(standardEntryNumList, "name");
|
|
for (String deptName : deptMap.keySet()) {
|
|
for (String deptName : deptMap.keySet()) {
|
|
//没有质控病历
|
|
//没有质控病历
|
|
if (!mrMap.containsKey(deptName)) {
|
|
if (!mrMap.containsKey(deptName)) {
|
|
@@ -266,6 +269,11 @@ public class ConsoleByDeptFacade {
|
|
}
|
|
}
|
|
//病历数
|
|
//病历数
|
|
Integer mrNum = mrMap.get(deptName).getNum();
|
|
Integer mrNum = mrMap.get(deptName).getNum();
|
|
|
|
+ //缺陷模块条目未维护
|
|
|
|
+ if (ListUtil.isEmpty(standardEntryNumList)) {
|
|
|
|
+ retMap.put(deptName, Lists.newLinkedList());
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
//没有缺陷
|
|
//没有缺陷
|
|
if (!qcEntryMap.containsKey(deptName)) {
|
|
if (!qcEntryMap.containsKey(deptName)) {
|
|
retMap.put(deptName, Lists.newLinkedList());
|
|
retMap.put(deptName, Lists.newLinkedList());
|
|
@@ -273,48 +281,38 @@ public class ConsoleByDeptFacade {
|
|
}
|
|
}
|
|
//模块缺陷
|
|
//模块缺陷
|
|
List<DeptNumDTO> qcEntryNumByDeptList = qcEntryMap.get(deptName);
|
|
List<DeptNumDTO> qcEntryNumByDeptList = qcEntryMap.get(deptName);
|
|
- List<NumDTO> retList = Lists.newLinkedList();
|
|
|
|
- retList = BeanUtil.listCopyTo(standardEntryNumList, NumDTO.class);
|
|
|
|
if (ListUtil.isEmpty(qcEntryNumByDeptList)) {
|
|
if (ListUtil.isEmpty(qcEntryNumByDeptList)) {
|
|
- for (NumDTO entryNum : retList) {
|
|
|
|
- Integer totleNum = entryNum.getNum() * mrNum;
|
|
|
|
- entryNum.setNum(0);
|
|
|
|
- entryNum.setPercent(0d);
|
|
|
|
- entryNum.setPercentStr("0%");
|
|
|
|
- entryNum.setTotleNum(totleNum);
|
|
|
|
|
|
+ retMap.put(deptName, Lists.newLinkedList());
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ List<NumDTO> retList = Lists.newLinkedList();
|
|
|
|
+ retList = BeanUtil.listCopyTo(qcEntryNumByDeptList, NumDTO.class);
|
|
|
|
+ retList.forEach(item -> {
|
|
|
|
+ if (!standardMap.containsKey(item.getName())) {
|
|
|
|
+ item.setTotleNum(0);
|
|
|
|
+ item.setPercent(0d);
|
|
|
|
+ item.setPercentStr("0%");
|
|
|
|
+ } else {
|
|
|
|
+ Integer totleNum = standardMap.get(item.getName()).getNum() * mrNum;
|
|
|
|
+ Double percent = BigDecimal.valueOf(item.getNum())
|
|
|
|
+ .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
|
+ .doubleValue();
|
|
|
|
+ String percentStr
|
|
|
|
+ = df.format(BigDecimal.valueOf(percent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
|
+ item.setTotleNum(totleNum);
|
|
|
|
+ item.setPercent(percent);
|
|
|
|
+ item.setPercentStr(percentStr);
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- Map<Long, Integer> qcEntryNumMap
|
|
|
|
- = EntityUtil.makeMapWithKeyValue(qcEntryNumByDeptList, "id", "num");
|
|
|
|
- if (ListUtil.isNotEmpty(standardEntryNumList)) {
|
|
|
|
- for (NumDTO entryNum : retList) {
|
|
|
|
- Integer totleNum = entryNum.getNum() * mrNum;
|
|
|
|
- if (qcEntryNumMap.containsKey(entryNum.getId())) {
|
|
|
|
- entryNum.setNum(qcEntryNumMap.get(entryNum.getId()));
|
|
|
|
- Double percent = BigDecimal.valueOf(entryNum.getNum())
|
|
|
|
- .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
|
- .doubleValue();
|
|
|
|
- String percentStr
|
|
|
|
- = df.format(BigDecimal.valueOf(percent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
|
- entryNum.setTotleNum(totleNum);
|
|
|
|
- entryNum.setPercent(percent);
|
|
|
|
- entryNum.setPercentStr(percentStr);
|
|
|
|
- } else {
|
|
|
|
- entryNum.setNum(0);
|
|
|
|
- entryNum.setPercent(0d);
|
|
|
|
- entryNum.setPercentStr("0%");
|
|
|
|
- entryNum.setTotleNum(totleNum);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //降序排序
|
|
|
|
+ Collections.sort(retList, new Comparator<NumDTO>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(NumDTO o1, NumDTO o2) {
|
|
|
|
+ return o2.getPercent().compareTo(o1.getPercent());
|
|
}
|
|
}
|
|
- //降序排序
|
|
|
|
- Collections.sort(retList, new Comparator<NumDTO>() {
|
|
|
|
- @Override
|
|
|
|
- public int compare(NumDTO o1, NumDTO o2) {
|
|
|
|
- return o2.getPercent().compareTo(o1.getPercent());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
|
|
//取top10
|
|
//取top10
|
|
retList = retList
|
|
retList = retList
|