|
@@ -11,6 +11,7 @@ import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.util.*;
|
|
|
import com.diagbot.vo.*;
|
|
|
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.factory.annotation.Autowired;
|
|
@@ -44,6 +45,8 @@ public class ConsoleByDeptFacade {
|
|
|
private SysHospitalSetFacade sysHospitalSetFacade;
|
|
|
@Autowired
|
|
|
private QcCasesEntryFacade qcCasesEntryFacade;
|
|
|
+ @Autowired
|
|
|
+ private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -60,40 +63,13 @@ public class ConsoleByDeptFacade {
|
|
|
if (deptMap == null) {
|
|
|
return retMap;
|
|
|
}
|
|
|
- //出院总人数
|
|
|
- List<NumDTO> totleNumList = behospitalInfoFacade.leaveHosCountByDept(filterVO);
|
|
|
- Map<String, NumDTO> totleMap = ListUtil.isEmpty(totleNumList)
|
|
|
- ? new HashMap<>()
|
|
|
- : EntityUtil.makeEntityMap(totleNumList, "name");
|
|
|
- Map<String, NumDTO> deathMap = new HashMap<>();
|
|
|
- Map<String, NumDTO> operationMap = new HashMap<>();
|
|
|
- //终末--死亡人数/手术病人数
|
|
|
- //死亡人数
|
|
|
- List<NumDTO> deathNumList = behospitalInfoFacade.deathCountByDept(filterVO);
|
|
|
- deathMap = ListUtil.isEmpty(deathNumList)
|
|
|
- ? new HashMap<>()
|
|
|
- : EntityUtil.makeEntityMap(deathNumList, "name");
|
|
|
- //手术人数
|
|
|
- List<NumDTO> operationNumList = behospitalInfoFacade.operationCountByDept(filterVO);
|
|
|
- operationMap = ListUtil.isEmpty(operationNumList)
|
|
|
- ? new HashMap<>()
|
|
|
- : EntityUtil.makeEntityMap(operationNumList, "name");
|
|
|
-
|
|
|
- for (String deptName : deptMap.keySet()) {
|
|
|
- Map<String, Object> map = new LinkedHashMap<>();
|
|
|
- map.put("总人数", 0);
|
|
|
- map.put("死亡人数", 0);
|
|
|
- map.put("手术病人数", 0);
|
|
|
- if (totleMap.containsKey(deptName)) {
|
|
|
- map.put("总人数", totleMap.get(deptName).getNum());
|
|
|
- }
|
|
|
- if(deathMap.containsKey(deptName)) {
|
|
|
- map.put("死亡人数", deathMap.get(deptName).getNum());
|
|
|
- }
|
|
|
- if(operationMap.containsKey(deptName)) {
|
|
|
- map.put("手术病人数", operationMap.get(deptName).getNum());
|
|
|
- }
|
|
|
- retMap.put(deptName, map);
|
|
|
+ try {
|
|
|
+ Map<String, Object> invokeParams = new HashMap<>();
|
|
|
+ invokeParams.put("filterVO", filterVO);
|
|
|
+ retMap = dataBeanAggregateQueryFacade.get("setAllLeaveHosCount", invokeParams, Map.class);
|
|
|
+ long L2 = System.currentTimeMillis();
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
|
|
|
}
|
|
|
return retMap;
|
|
|
}
|
|
@@ -123,98 +99,78 @@ public class ConsoleByDeptFacade {
|
|
|
DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
Map<String, Object> retMap = new LinkedHashMap<>();
|
|
|
filterFacade.filterVOSet(filterVO);
|
|
|
- QcresultFilterVO qcresultFilterVO = new QcresultFilterVO();
|
|
|
- BeanUtil.copyProperties(filterVO, qcresultFilterVO);
|
|
|
//关联科室
|
|
|
Map<String, Object> deptMap = getDeptByUser(filterVO);
|
|
|
if (deptMap == null) {
|
|
|
return retMap;
|
|
|
}
|
|
|
- //质控病历总数
|
|
|
- List<NumDTO> totleNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
|
|
|
- Map<String, NumDTO> totleMap = ListUtil.isEmpty(totleNumList)
|
|
|
- ? new HashMap<>()
|
|
|
- : EntityUtil.makeEntityMap(totleNumList, "name");
|
|
|
- //甲级病历
|
|
|
- qcresultFilterVO.setLevel("甲");
|
|
|
- List<NumDTO> firstNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
|
|
|
- Map<String, NumDTO> firstMap = ListUtil.isEmpty(firstNumList)
|
|
|
- ? new HashMap<>()
|
|
|
- : EntityUtil.makeEntityMap(firstNumList, "name");
|
|
|
- //乙级病历
|
|
|
- qcresultFilterVO.setLevel("乙");
|
|
|
- List<NumDTO> secondNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
|
|
|
- Map<String, NumDTO> secondMap = ListUtil.isEmpty(secondNumList)
|
|
|
- ? new HashMap<>()
|
|
|
- : EntityUtil.makeEntityMap(secondNumList, "name");
|
|
|
- //丙级病历
|
|
|
- qcresultFilterVO.setLevel("丙");
|
|
|
- List<NumDTO> thirdNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
|
|
|
- Map<String, NumDTO> thirdMap = ListUtil.isEmpty(thirdNumList)
|
|
|
- ? new HashMap<>()
|
|
|
- : EntityUtil.makeEntityMap(thirdNumList, "name");
|
|
|
- for (String deptName : deptMap.keySet()) {
|
|
|
- List<NumDTO> retList = Lists.newLinkedList();
|
|
|
- int totleNum = 0;
|
|
|
- int firstLevelNum = 0;
|
|
|
- int secondLevelNum = 0;
|
|
|
- int thirdLevelNum = 0;
|
|
|
- if (totleMap.containsKey(deptName)) {
|
|
|
- totleNum = totleMap.get(deptName).getNum();
|
|
|
- }
|
|
|
- if (firstMap.containsKey(deptName)) {
|
|
|
- firstLevelNum = firstMap.get(deptName).getNum();
|
|
|
- }
|
|
|
- if (secondMap.containsKey(deptName)) {
|
|
|
- secondLevelNum = secondMap.get(deptName).getNum();
|
|
|
- }
|
|
|
- if (thirdMap.containsKey(deptName)) {
|
|
|
- thirdLevelNum = thirdMap.get(deptName).getNum();
|
|
|
- }
|
|
|
- //总病历数为0
|
|
|
- if (totleNum == 0) {
|
|
|
- retMap.put(deptName, Lists.newLinkedList());
|
|
|
- continue;
|
|
|
+ QcresultFilterVO qcresultFilterVO = new QcresultFilterVO();
|
|
|
+ BeanUtil.copyProperties(filterVO, qcresultFilterVO);
|
|
|
+ //质控病历数
|
|
|
+ List<Map<String,Object>> maps = qcresultInfoFacade.resultMrCountByDept(qcresultFilterVO);
|
|
|
+ if(ListUtil.isEmpty(maps)){
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ for (Map<String, Object> map : maps) {
|
|
|
+ if(null != map.get("NAME") && StringUtils.isNotBlank(map.get("NAME").toString()) && deptMap.containsKey(map.get("NAME").toString())){
|
|
|
+ List<NumDTO> retList = Lists.newLinkedList();
|
|
|
+ int totleNum = 0;
|
|
|
+ int firstLevelNum = 0;
|
|
|
+ int secondLevelNum = 0;
|
|
|
+ int thirdLevelNum = 0;
|
|
|
+ if(null != map.get("num")){
|
|
|
+ totleNum = Integer.parseInt(map.get("num").toString());
|
|
|
+ }
|
|
|
+ if(null != map.get("firNum")){
|
|
|
+ firstLevelNum = Integer.parseInt(map.get("firNum").toString());
|
|
|
+ }
|
|
|
+ if(null != map.get("secNum")){
|
|
|
+ secondLevelNum = Integer.parseInt(map.get("secNum").toString());
|
|
|
+ }
|
|
|
+ if(null != map.get("thrNum")){
|
|
|
+ thirdLevelNum = Integer.parseInt(map.get("thrNum").toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ NumDTO totleNumDTO = new NumDTO();
|
|
|
+ totleNumDTO.setName("累计质控病历数");
|
|
|
+ totleNumDTO.setTotleNum(totleNum);
|
|
|
+ totleNumDTO.setNum(totleNum);
|
|
|
+ NumDTO firstLevelNumDTO = new NumDTO();
|
|
|
+ firstLevelNumDTO.setName("甲级病历");
|
|
|
+ firstLevelNumDTO.setNum(firstLevelNum);
|
|
|
+ firstLevelNumDTO.setTotleNum(totleNum);
|
|
|
+ Double firstPercent = BigDecimal.valueOf(firstLevelNum)
|
|
|
+ .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
+ String firstPercentStr = df.format(BigDecimal.valueOf(firstPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+ firstLevelNumDTO.setPercent(firstPercent);
|
|
|
+ firstLevelNumDTO.setPercentStr(firstPercentStr);
|
|
|
+ NumDTO secondLevelNumDTO = new NumDTO();
|
|
|
+ secondLevelNumDTO.setName("乙级病历");
|
|
|
+ secondLevelNumDTO.setNum(secondLevelNum);
|
|
|
+ secondLevelNumDTO.setTotleNum(totleNum);
|
|
|
+ Double secondPercent = BigDecimal.valueOf(secondLevelNum)
|
|
|
+ .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
+ String secondPercentStr = df.format(BigDecimal.valueOf(secondPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+ secondLevelNumDTO.setPercent(secondPercent);
|
|
|
+ secondLevelNumDTO.setPercentStr(secondPercentStr);
|
|
|
+ NumDTO thirdLevelNumDTO = new NumDTO();
|
|
|
+ thirdLevelNumDTO.setName("丙级病历");
|
|
|
+ thirdLevelNumDTO.setNum(thirdLevelNum);
|
|
|
+ thirdLevelNumDTO.setTotleNum(totleNum);
|
|
|
+ Double thirdPercent = BigDecimal.valueOf(thirdLevelNum)
|
|
|
+ .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
+ .doubleValue();
|
|
|
+ String thirdPercentStr = df.format(BigDecimal.valueOf(thirdPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
+ thirdLevelNumDTO.setPercent(thirdPercent);
|
|
|
+ thirdLevelNumDTO.setPercentStr(thirdPercentStr);
|
|
|
+ retList.add(totleNumDTO);
|
|
|
+ retList.add(firstLevelNumDTO);
|
|
|
+ retList.add(secondLevelNumDTO);
|
|
|
+ retList.add(thirdLevelNumDTO);
|
|
|
+ retMap.put(map.get("NAME").toString(), retList);
|
|
|
}
|
|
|
- NumDTO totleNumDTO = new NumDTO();
|
|
|
- totleNumDTO.setName("累计质控病历数");
|
|
|
- totleNumDTO.setTotleNum(totleNum);
|
|
|
- totleNumDTO.setNum(totleNum);
|
|
|
- NumDTO firstLevelNumDTO = new NumDTO();
|
|
|
- firstLevelNumDTO.setName("甲级病历");
|
|
|
- firstLevelNumDTO.setNum(firstLevelNum);
|
|
|
- firstLevelNumDTO.setTotleNum(totleNum);
|
|
|
- Double firstPercent = BigDecimal.valueOf(firstLevelNum)
|
|
|
- .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
- .doubleValue();
|
|
|
- String firstPercentStr = df.format(BigDecimal.valueOf(firstPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
- firstLevelNumDTO.setPercent(firstPercent);
|
|
|
- firstLevelNumDTO.setPercentStr(firstPercentStr);
|
|
|
- NumDTO secondLevelNumDTO = new NumDTO();
|
|
|
- secondLevelNumDTO.setName("乙级病历");
|
|
|
- secondLevelNumDTO.setNum(secondLevelNum);
|
|
|
- secondLevelNumDTO.setTotleNum(totleNum);
|
|
|
- Double secondPercent = BigDecimal.valueOf(secondLevelNum)
|
|
|
- .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
- .doubleValue();
|
|
|
- String secondPercentStr = df.format(BigDecimal.valueOf(secondPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
- secondLevelNumDTO.setPercent(secondPercent);
|
|
|
- secondLevelNumDTO.setPercentStr(secondPercentStr);
|
|
|
- NumDTO thirdLevelNumDTO = new NumDTO();
|
|
|
- thirdLevelNumDTO.setName("丙级病历");
|
|
|
- thirdLevelNumDTO.setNum(thirdLevelNum);
|
|
|
- thirdLevelNumDTO.setTotleNum(totleNum);
|
|
|
- Double thirdPercent = BigDecimal.valueOf(thirdLevelNum)
|
|
|
- .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
|
|
|
- .doubleValue();
|
|
|
- String thirdPercentStr = df.format(BigDecimal.valueOf(thirdPercent).multiply(BigDecimal.valueOf(100))) + "%";
|
|
|
- thirdLevelNumDTO.setPercent(thirdPercent);
|
|
|
- thirdLevelNumDTO.setPercentStr(thirdPercentStr);
|
|
|
- retList.add(totleNumDTO);
|
|
|
- retList.add(firstLevelNumDTO);
|
|
|
- retList.add(secondLevelNumDTO);
|
|
|
- retList.add(thirdLevelNumDTO);
|
|
|
- retMap.put(deptName, retList);
|
|
|
}
|
|
|
return retMap;
|
|
|
}
|