|
@@ -14,6 +14,7 @@ import com.diagbot.enums.RuleBaseTypeEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.enums.TypeEnum;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.MsgUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
@@ -161,6 +162,7 @@ public class MedRuleConvertFacade {
|
|
|
Map<Integer, List<ResultRule>> tempMap = new HashMap<>();
|
|
|
Integer num = 1;
|
|
|
for (RuleDTO record : entry.getValue()) {
|
|
|
+ System.out.println(FastJsonUtils.getBeanToJson(record));
|
|
|
List<ResultRule> tempList = Lists.newLinkedList();
|
|
|
|
|
|
ResultRule result = new ResultRule();
|
|
@@ -185,26 +187,27 @@ public class MedRuleConvertFacade {
|
|
|
result.setRuleBaseHisDetailName("");
|
|
|
result.setGroupType(record.getGroupType());
|
|
|
|
|
|
- //年龄转换数值
|
|
|
- switch (result.getRuleBaseLibName()) {
|
|
|
- case "新生儿":
|
|
|
- result.setRuleBaseInputValue(random_int(1, 12, true, true).toString());
|
|
|
- result.setRuleBaseUnit("月");
|
|
|
- break;
|
|
|
- case "幼儿":
|
|
|
- result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
- break;
|
|
|
- case "儿童":
|
|
|
- result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
- break;
|
|
|
- case "成人":
|
|
|
- result.setRuleBaseInputValue(random_int(18, 200, true, false).toString());
|
|
|
- break;
|
|
|
- case "月经期":
|
|
|
- result.setRuleBaseInputValue(random_int(0, 99, true, true).toString());
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ if (StringUtil.isNotBlank(result.getRuleBaseLibName())) {
|
|
|
+ switch (result.getRuleBaseLibName()) {
|
|
|
+ case "新生儿":
|
|
|
+ result.setRuleBaseInputValue(random_int(1, 12, true, true).toString());
|
|
|
+ result.setRuleBaseUnit("月");
|
|
|
+ break;
|
|
|
+ case "幼儿":
|
|
|
+ result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
+ break;
|
|
|
+ case "儿童":
|
|
|
+ result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
+ break;
|
|
|
+ case "成人":
|
|
|
+ result.setRuleBaseInputValue(random_int(18, 200, true, false).toString());
|
|
|
+ break;
|
|
|
+ case "月经期":
|
|
|
+ result.setRuleBaseInputValue(random_int(0, 99, true, true).toString());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -235,8 +238,8 @@ public class MedRuleConvertFacade {
|
|
|
if (record.getRuleBaseMaxValue() >= record.getRuleBaseMinValue()) {
|
|
|
ResultRule valResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, valResult);
|
|
|
- valResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()));
|
|
|
- valResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()));
|
|
|
+ valResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
+ valResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (valResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& valResult.getRuleBaseMinValue().doubleValue() > 1D) {
|
|
|
valResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
@@ -262,7 +265,7 @@ public class MedRuleConvertFacade {
|
|
|
//大于最小值inputValue>minValue
|
|
|
ResultRule gtResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, gtResult);
|
|
|
- gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()));
|
|
|
+ gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (gtResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& gtResult.getRuleBaseMinValue().doubleValue() > 1D) {
|
|
|
gtResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
@@ -285,7 +288,7 @@ public class MedRuleConvertFacade {
|
|
|
ResultRule ltResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, ltResult);
|
|
|
//inputValue>minValue
|
|
|
- ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()));
|
|
|
+ ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (ltResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& ltResult.getRuleBaseMaxValue().doubleValue() > 1D) {
|
|
|
ltResult.setRuleBaseInputValue(random_int(null,
|
|
@@ -308,7 +311,7 @@ public class MedRuleConvertFacade {
|
|
|
&& StringUtil.isBlank(record.getRuleBaseMaxOperator())) {
|
|
|
ResultRule gtResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, gtResult);
|
|
|
- gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()));
|
|
|
+ gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (gtResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& gtResult.getRuleBaseMinValue().doubleValue() > 1D) {
|
|
|
gtResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
@@ -331,7 +334,7 @@ public class MedRuleConvertFacade {
|
|
|
ResultRule ltResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, ltResult);
|
|
|
//inputValue>minValue
|
|
|
- ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()));
|
|
|
+ ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (ltResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& ltResult.getRuleBaseMaxValue().doubleValue() > 1D) {
|
|
|
ltResult.setRuleBaseInputValue(random_int(null,
|
|
@@ -388,9 +391,10 @@ public class MedRuleConvertFacade {
|
|
|
for (ResultRule result : entry.getValue()) {
|
|
|
List<ResultRule> tempList = Lists.newLinkedList();
|
|
|
if (result.getHasSubCond() != null && result.getHasSubCond().equals(1)) {
|
|
|
- if (result.getRuleBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
|
|
|
+ if (result.getRuleBaseLibType() != null
|
|
|
+ && (result.getRuleBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
|
|
|
|| result.getRuleBaseLibType().equals(LexiconEnum.MedZhiLiaoClass.getKey())
|
|
|
- || result.getRuleBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey())) {
|
|
|
+ || result.getRuleBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey()))) {
|
|
|
List<String> medicines = medClassMedMap.get(result.getRuleBaseLibName());
|
|
|
if (ListUtil.isNotEmpty(medicines)) {
|
|
|
for (String med : medicines) {
|
|
@@ -671,7 +675,7 @@ public class MedRuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
- public List<ResultRule> addRuleOrderNo(Map<Integer, List<ResultRule>> map, Integer index, List<ResultRule> tempList, List<ResultRule> retList) {
|
|
|
+ public List<ResultRule> addRuleOrderNo(Map<Integer, List<ResultRule>> map, Integer index, List<ResultRule> tempList, List<ResultRule> retList) {
|
|
|
if (index < map.size()) {
|
|
|
List<ResultRule> list = map.get(index++);
|
|
|
for (ResultRule subResult : list) {
|