|
@@ -1,7 +1,6 @@
|
|
|
package com.diagbot.aggregate;
|
|
|
|
|
|
import com.diagbot.dto.NumDTO;
|
|
|
-import com.diagbot.dto.ResultDetailDTO;
|
|
|
import com.diagbot.facade.BehospitalInfoFacade;
|
|
|
import com.diagbot.facade.QcCasesFacade;
|
|
|
import com.diagbot.facade.QcresultInfoFacade;
|
|
@@ -44,15 +43,15 @@ public class ResultStatisticsAggregate {
|
|
|
@DataProvider("setAllResult")
|
|
|
public Map<String, Object> setAllResult(
|
|
|
@InvokeParameter("filterVO") FilterVO filterVO,
|
|
|
- @DataConsumer("getResultDept") List<ResultDetailDTO> results,
|
|
|
+ @DataConsumer("entryByDept") List<NumDTO> deptList,
|
|
|
@DataConsumer("entryCountGroupByEntry") List<NumDTO> entryList,
|
|
|
@DataConsumer("entryCountGroupByCase") List<NumDTO> caseList) {
|
|
|
Map<String, Object> retMap = new LinkedHashMap<>();
|
|
|
retMap.put("各科室缺陷占比", Lists.newLinkedList());
|
|
|
retMap.put("各模块缺陷占比排行", Lists.newLinkedList());
|
|
|
retMap.put("条目缺陷占比", Lists.newLinkedList());
|
|
|
- if (ListUtil.isNotEmpty(results)) {
|
|
|
- retMap.put("各科室缺陷占比", results);
|
|
|
+ if (ListUtil.isNotEmpty(deptList)) {
|
|
|
+ retMap.put("各科室缺陷占比", deptList);
|
|
|
}
|
|
|
if (ListUtil.isNotEmpty(caseList)) {
|
|
|
retMap.put("各模块缺陷占比排行", caseList);
|
|
@@ -198,49 +197,49 @@ public class ResultStatisticsAggregate {
|
|
|
* @return
|
|
|
*/
|
|
|
@DataProvider("getResultDept")
|
|
|
- public List<ResultDetailDTO> getResultDept(@InvokeParameter("filterVO") FilterVO filterVO) {
|
|
|
- List<ResultDetailDTO> results2 = behospitalInfoFacade.resultStatisticsByDept2(filterVO);
|
|
|
- if (ListUtil.isNotEmpty(results2)) {
|
|
|
- int totle = results2
|
|
|
+ public List<NumDTO> getResultDept(@InvokeParameter("filterVO") FilterVO filterVO) {
|
|
|
+ List<NumDTO> numDTOList = behospitalInfoFacade.resultStatisticsByDept2(filterVO);
|
|
|
+ if (ListUtil.isNotEmpty(numDTOList)) {
|
|
|
+ int totle = numDTOList
|
|
|
.stream()
|
|
|
- .map(ResultDetailDTO::getNum)
|
|
|
+ .map(NumDTO::getNum)
|
|
|
.reduce(0, Integer::sum);
|
|
|
- results2.forEach(result -> {
|
|
|
+ numDTOList.forEach(result -> {
|
|
|
Double percent = BigDecimal.valueOf(result.getNum())
|
|
|
.divide(BigDecimal.valueOf(totle), 4, RoundingMode.HALF_UP)
|
|
|
.doubleValue();
|
|
|
result.setPercent(percent);
|
|
|
});
|
|
|
- List<ResultDetailDTO> retResults = Lists.newLinkedList();
|
|
|
- if (results2.size() <= 10) {
|
|
|
- retResults = BeanUtil.listCopyTo(results2, ResultDetailDTO.class);
|
|
|
+ List<NumDTO> retList = Lists.newLinkedList();
|
|
|
+ if (numDTOList.size() <= 10) {
|
|
|
+ retList = BeanUtil.listCopyTo(numDTOList, NumDTO.class);
|
|
|
} else {
|
|
|
|
|
|
Double rate = 0d;
|
|
|
Integer num = 0;
|
|
|
- for (ResultDetailDTO result : results2) {
|
|
|
- if (retResults.size() < 9) {
|
|
|
+ for (NumDTO numDTO : numDTOList) {
|
|
|
+ if (retList.size() < 9) {
|
|
|
rate = BigDecimal.valueOf(rate)
|
|
|
- .add(BigDecimal.valueOf(Double.valueOf(result.getPercent())))
|
|
|
+ .add(BigDecimal.valueOf(Double.valueOf(numDTO.getPercent())))
|
|
|
.doubleValue();
|
|
|
- retResults.add(result);
|
|
|
+ retList.add(numDTO);
|
|
|
} else {
|
|
|
- num += result.getNum();
|
|
|
+ num += numDTO.getNum();
|
|
|
}
|
|
|
}
|
|
|
- ResultDetailDTO retResult = new ResultDetailDTO();
|
|
|
- retResult.setName("其他");
|
|
|
- retResult.setNum(num);
|
|
|
- retResult.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
|
|
|
- retResults.add(retResult);
|
|
|
+ NumDTO otherNumDTO = new NumDTO();
|
|
|
+ otherNumDTO.setName("其他");
|
|
|
+ otherNumDTO.setNum(num);
|
|
|
+ otherNumDTO.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
|
|
|
+ retList.add(otherNumDTO);
|
|
|
}
|
|
|
- retResults.forEach(result -> {
|
|
|
+ retList.forEach(result -> {
|
|
|
DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
String percentStr
|
|
|
= df.format(BigDecimal.valueOf(result.getPercent()).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
result.setPercentStr(percentStr);
|
|
|
});
|
|
|
- return retResults;
|
|
|
+ return retList;
|
|
|
}
|
|
|
return null;
|
|
|
}
|