|
@@ -3,13 +3,17 @@ package com.diagbot.facade;
|
|
|
import com.diagbot.dto.AlgorithmDTO;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.BigDecimalUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.vo.AlgorithmVO;
|
|
|
+import com.diagbot.vo.MedQcresultCasesVO;
|
|
|
import com.diagbot.vo.QcResultAlgVO;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -50,11 +54,77 @@ public class AlgorithmFacade {
|
|
|
}
|
|
|
//处理数据
|
|
|
dataDeal(algorithmVO);
|
|
|
+
|
|
|
+ BigDecimal res = BigDecimal.ZERO;
|
|
|
//计算得分
|
|
|
- BigDecimal res = cal(algorithmVO);
|
|
|
+ if (algorithmVO.getHospitalId().equals(1L)) {
|
|
|
+ //长兴医院的情况下
|
|
|
+ List<QcResultAlgVO> qcResultAlgHomePage = new ArrayList<>();
|
|
|
+ List<QcResultAlgVO> qcResultAlgHomePageExt = new ArrayList<>();
|
|
|
+ for (QcResultAlgVO qcResultAlgVO : algorithmVO.getQcResultAlgVOList()) {
|
|
|
+ //首页的情况
|
|
|
+ if (qcResultAlgVO.getCasesId().equals(243L)) {
|
|
|
+ qcResultAlgHomePage.add(qcResultAlgVO);
|
|
|
+ } else {
|
|
|
+ //非首页
|
|
|
+ qcResultAlgHomePageExt.add(qcResultAlgVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<MedQcresultCasesVO> medQcresultCasesVOList = new ArrayList<>();
|
|
|
+ //病案首页
|
|
|
+ AlgorithmVO homePage = new AlgorithmVO();
|
|
|
+ BeanUtil.copyProperties(algorithmVO, homePage);
|
|
|
+ homePage.setQcResultAlgVOList(qcResultAlgHomePage);
|
|
|
+ homePage.setIsHomePage(true);
|
|
|
+ BigDecimal homePageRes = cal(homePage);
|
|
|
+ String level = getHomePageLevel(homePageRes);
|
|
|
+ MedQcresultCasesVO medQcresultCasesVOHp = new MedQcresultCasesVO();
|
|
|
+ medQcresultCasesVOHp.setHospitalId(algorithmVO.getHospitalId());
|
|
|
+ medQcresultCasesVOHp.setBehospitalCode(algorithmVO.getBehospitalCode());
|
|
|
+ medQcresultCasesVOHp.setCasesId(243L);
|
|
|
+ medQcresultCasesVOHp.setScoreRes(homePageRes);
|
|
|
+ medQcresultCasesVOHp.setLevel(level);
|
|
|
+ medQcresultCasesVOList.add(medQcresultCasesVOHp);
|
|
|
+ //病案首页以外
|
|
|
+ AlgorithmVO homePageExt = new AlgorithmVO();
|
|
|
+ BeanUtil.copyProperties(algorithmVO, homePageExt);
|
|
|
+ homePageExt.setQcResultAlgVOList(qcResultAlgHomePageExt);
|
|
|
+ BigDecimal homePageExtRes = cal(homePageExt);
|
|
|
+ MedQcresultCasesVO medQcresultCasesVOHpExt = new MedQcresultCasesVO();
|
|
|
+ medQcresultCasesVOHpExt.setHospitalId(algorithmVO.getHospitalId());
|
|
|
+ medQcresultCasesVOHpExt.setBehospitalCode(algorithmVO.getBehospitalCode());
|
|
|
+ medQcresultCasesVOHpExt.setCasesId(0L);
|
|
|
+ medQcresultCasesVOHpExt.setScoreRes(homePageExtRes);
|
|
|
+ medQcresultCasesVOHpExt.setLevel("");
|
|
|
+ medQcresultCasesVOList.add(medQcresultCasesVOHpExt);
|
|
|
+ algorithmVO.setMedQcresultCasesVOList(medQcresultCasesVOList);
|
|
|
+
|
|
|
+ res = homePageRes
|
|
|
+ .add(homePageExtRes)
|
|
|
+ .multiply(new BigDecimal(100))
|
|
|
+ .divide(new BigDecimal(120), 1, RoundingMode.HALF_UP);
|
|
|
+ } else {
|
|
|
+ //非长兴医院的情况下
|
|
|
+ res = cal(algorithmVO);
|
|
|
+ }
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据分数评定等级(病案首页)
|
|
|
+ *
|
|
|
+ * @param score 评分分数
|
|
|
+ * @return 等级
|
|
|
+ */
|
|
|
+ private String getHomePageLevel(BigDecimal score) {
|
|
|
+ String level = "不合格";
|
|
|
+ //得分≥18分为甲级
|
|
|
+ if (BigDecimalUtil.ge(score, new BigDecimal(18))) {
|
|
|
+ level = "合格";
|
|
|
+ }
|
|
|
+ return level;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据分数评定等级
|
|
|
*
|
|
@@ -160,6 +230,10 @@ public class AlgorithmFacade {
|
|
|
*/
|
|
|
private BigDecimal cal(AlgorithmVO algorithmVO) {
|
|
|
BigDecimal res = new BigDecimal(100);
|
|
|
+ if (algorithmVO.getHospitalId().equals(1L)
|
|
|
+ && algorithmVO.getIsHomePage().equals(true)) {
|
|
|
+ res = new BigDecimal(20);
|
|
|
+ }
|
|
|
//模块总分
|
|
|
Map<Long, BigDecimal> casesMap = new HashMap<>();
|
|
|
//单票否决计分
|
|
@@ -228,6 +302,11 @@ public class AlgorithmFacade {
|
|
|
System.out.println("60:" + algorithmFacade.getLevel(new BigDecimal(60)));
|
|
|
System.out.println("0:" + algorithmFacade.getLevel(new BigDecimal(0)));
|
|
|
|
|
|
+
|
|
|
+ System.out.println("18:" + algorithmFacade.getHomePageLevel(new BigDecimal(20)));
|
|
|
+ System.out.println("18:" + algorithmFacade.getHomePageLevel(new BigDecimal(18)));
|
|
|
+ System.out.println("17.9:" + algorithmFacade.getHomePageLevel(new BigDecimal(17.9)));
|
|
|
+
|
|
|
if (BigDecimalUtil.lt(new BigDecimal(-1), BigDecimal.ZERO)) {
|
|
|
System.out.println(BigDecimal.ZERO);
|
|
|
}
|