|
@@ -230,6 +230,7 @@ public class MedRuleConvertFacade {
|
|
|
result.setReferenceValue(record.getRuleMsg());
|
|
|
}
|
|
|
|
|
|
+ Integer accuracy = 2;
|
|
|
if (StringUtil.isNotBlank(result.getRuleBaseLibName())) {
|
|
|
switch (result.getRuleBaseLibName()) {
|
|
|
case "新生儿":
|
|
@@ -248,6 +249,21 @@ public class MedRuleConvertFacade {
|
|
|
case "月经期":
|
|
|
result.setRuleBaseInputValue(random_int(0, 99, true, true).toString());
|
|
|
break;
|
|
|
+ case "年龄":
|
|
|
+ accuracy = 3;
|
|
|
+ break;
|
|
|
+ case "体温":
|
|
|
+ accuracy = 1;
|
|
|
+ break;
|
|
|
+ case "心率":
|
|
|
+ accuracy = 0;
|
|
|
+ break;
|
|
|
+ case "收缩压":
|
|
|
+ accuracy = 0;
|
|
|
+ break;
|
|
|
+ case "舒张压":
|
|
|
+ accuracy = 0;
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -262,10 +278,7 @@ public class MedRuleConvertFacade {
|
|
|
BeanUtil.copyProperties(result, valResult);
|
|
|
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.getRuleBaseLibName().equals("收缩压")
|
|
|
- || valResult.getRuleBaseLibName().equals("舒张压")) {
|
|
|
+ if (accuracy.equals(0)) {
|
|
|
valResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
|
record.getRuleBaseMaxValue().intValue(),
|
|
|
(record.getRuleBaseMaxOperator().equals("<=") ? true : false),
|
|
@@ -274,7 +287,8 @@ public class MedRuleConvertFacade {
|
|
|
valResult.setRuleBaseInputValue(random(new BigDecimal(record.getRuleBaseMinValue()),
|
|
|
new BigDecimal(record.getRuleBaseMaxValue()),
|
|
|
(record.getRuleBaseMaxOperator().equals("<=") ? true : false),
|
|
|
- (record.getRuleBaseMinOperator().equals(">=") ? true : false)).toString());
|
|
|
+ (record.getRuleBaseMinOperator().equals(">=") ? true : false),
|
|
|
+ accuracy).toString());
|
|
|
}
|
|
|
valResult.setRuleBaseUnit(StringUtil.isNotBlank(record.getRuleBaseMinUnit()) ? record.getRuleBaseMinUnit()
|
|
|
: (StringUtil.isNotBlank(record.getRuleBaseMaxUnit()) ? record.getRuleBaseMaxUnit() : ""));
|
|
@@ -291,10 +305,7 @@ public class MedRuleConvertFacade {
|
|
|
ResultRule gtResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, gtResult);
|
|
|
gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
- if ((gtResult.getRuleBaseLibName().equals("年龄")
|
|
|
- && gtResult.getRuleBaseMinValue().doubleValue() > 1D)
|
|
|
- || gtResult.getRuleBaseLibName().equals("收缩压")
|
|
|
- || gtResult.getRuleBaseLibName().equals("舒张压")) {
|
|
|
+ if (accuracy.equals(0)) {
|
|
|
gtResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
|
null,
|
|
|
(record.getRuleBaseMinOperator().equals(">=") ? true : false),
|
|
@@ -303,7 +314,8 @@ public class MedRuleConvertFacade {
|
|
|
gtResult.setRuleBaseInputValue(random(new BigDecimal(record.getRuleBaseMinValue()),
|
|
|
null,
|
|
|
(record.getRuleBaseMinOperator().equals(">=") ? true : false),
|
|
|
- false).toString());
|
|
|
+ false,
|
|
|
+ accuracy).toString());
|
|
|
}
|
|
|
gtResult.setRuleBaseUnit(StringUtil.isNotBlank(record.getRuleBaseMinUnit()) ? record.getRuleBaseMinUnit() : "");
|
|
|
gtResult.setReferenceValue(record.getRuleBaseMinOperator()
|
|
@@ -316,10 +328,7 @@ public class MedRuleConvertFacade {
|
|
|
BeanUtil.copyProperties(result, ltResult);
|
|
|
//inputValue>minValue
|
|
|
ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
- if ((ltResult.getRuleBaseLibName().equals("年龄")
|
|
|
- && ltResult.getRuleBaseMaxValue().doubleValue() > 1D)
|
|
|
- || ltResult.getRuleBaseLibName().equals("收缩压")
|
|
|
- || ltResult.getRuleBaseLibName().equals("舒张压")) {
|
|
|
+ if (accuracy.equals(0)) {
|
|
|
ltResult.setRuleBaseInputValue(random_int(null,
|
|
|
record.getRuleBaseMaxValue().intValue(),
|
|
|
false,
|
|
@@ -328,7 +337,8 @@ public class MedRuleConvertFacade {
|
|
|
ltResult.setRuleBaseInputValue(random(null,
|
|
|
new BigDecimal(record.getRuleBaseMaxValue()),
|
|
|
false,
|
|
|
- (record.getRuleBaseMaxOperator().equals("<=") ? true : false)).toString());
|
|
|
+ (record.getRuleBaseMaxOperator().equals("<=") ? true : false),
|
|
|
+ accuracy).toString());
|
|
|
}
|
|
|
ltResult.setRuleBaseUnit(StringUtil.isNotBlank(record.getRuleBaseMaxUnit()) ? record.getRuleBaseMaxUnit() : "");
|
|
|
ltResult.setReferenceValue(record.getRuleBaseMaxOperator()
|
|
@@ -341,10 +351,7 @@ public class MedRuleConvertFacade {
|
|
|
ResultRule gtResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, gtResult);
|
|
|
gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
- if ((gtResult.getRuleBaseLibName().equals("年龄")
|
|
|
- && gtResult.getRuleBaseMinValue().doubleValue() > 1D)
|
|
|
- || gtResult.getRuleBaseLibName().equals("收缩压")
|
|
|
- || gtResult.getRuleBaseLibName().equals("舒张压")) {
|
|
|
+ if (accuracy.equals(0)) {
|
|
|
gtResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
|
null,
|
|
|
(record.getRuleBaseMinOperator().equals(">=") ? true : false),
|
|
@@ -353,7 +360,8 @@ public class MedRuleConvertFacade {
|
|
|
gtResult.setRuleBaseInputValue(random(new BigDecimal(record.getRuleBaseMinValue()),
|
|
|
null,
|
|
|
(record.getRuleBaseMinOperator().equals(">=") ? true : false),
|
|
|
- false).toString());
|
|
|
+ false,
|
|
|
+ accuracy).toString());
|
|
|
}
|
|
|
gtResult.setRuleBaseUnit(StringUtil.isNotBlank(record.getRuleBaseMinUnit()) ? record.getRuleBaseMinUnit() : "");
|
|
|
gtResult.setReferenceValue(record.getRuleBaseMinOperator()
|
|
@@ -366,10 +374,7 @@ public class MedRuleConvertFacade {
|
|
|
BeanUtil.copyProperties(result, ltResult);
|
|
|
//inputValue>minValue
|
|
|
ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
- if ((ltResult.getRuleBaseLibName().equals("年龄")
|
|
|
- && ltResult.getRuleBaseMaxValue().doubleValue() > 1D)
|
|
|
- || ltResult.getRuleBaseLibName().equals("收缩压")
|
|
|
- || ltResult.getRuleBaseLibName().equals("舒张压")) {
|
|
|
+ if (accuracy.equals(0)) {
|
|
|
ltResult.setRuleBaseInputValue(random_int(null,
|
|
|
record.getRuleBaseMaxValue().intValue(),
|
|
|
false,
|
|
@@ -378,7 +383,8 @@ public class MedRuleConvertFacade {
|
|
|
ltResult.setRuleBaseInputValue(random(null,
|
|
|
new BigDecimal(record.getRuleBaseMaxValue()),
|
|
|
false,
|
|
|
- (record.getRuleBaseMaxOperator().equals("<=") ? true : false)).toString());
|
|
|
+ (record.getRuleBaseMaxOperator().equals("<=") ? true : false),
|
|
|
+ accuracy).toString());
|
|
|
}
|
|
|
ltResult.setRuleBaseUnit(StringUtil.isNotBlank(record.getRuleBaseMaxUnit()) ? record.getRuleBaseMaxUnit() : "");
|
|
|
ltResult.setReferenceValue(record.getRuleBaseMaxOperator()
|
|
@@ -1163,9 +1169,16 @@ public class MedRuleConvertFacade {
|
|
|
conType,
|
|
|
orderType);
|
|
|
} else if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Vital.getKey())) {
|
|
|
- String content = resultRule.getRuleBaseLibName();
|
|
|
- if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
- content += resultRule.getRuleBaseInputValue();
|
|
|
+ String content = "";
|
|
|
+ if (resultRule.getRuleBaseLibName().equals("收缩压")) {
|
|
|
+ content = "血压" + resultRule.getRuleBaseInputValue() + "/80";
|
|
|
+ } else if (resultRule.getRuleBaseLibName().equals("舒张压")) {
|
|
|
+ content = "血压120/" + resultRule.getRuleBaseInputValue();
|
|
|
+ } else {
|
|
|
+ content = resultRule.getRuleBaseLibName();
|
|
|
+ if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
+ content += resultRule.getRuleBaseInputValue();
|
|
|
+ }
|
|
|
}
|
|
|
billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(),
|
|
|
resultRule.getRuleLibName(),
|
|
@@ -1541,9 +1554,16 @@ public class MedRuleConvertFacade {
|
|
|
conType,
|
|
|
orderType);
|
|
|
} else if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Vital.getKey())) {
|
|
|
- String content = resultRule.getRuleBaseLibName();
|
|
|
- if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
- content += resultRule.getRuleBaseInputValue();
|
|
|
+ String content = "";
|
|
|
+ if (resultRule.getRuleBaseLibName().equals("收缩压")) {
|
|
|
+ content = "血压" + resultRule.getRuleBaseInputValue() + "/80";
|
|
|
+ } else if (resultRule.getRuleBaseLibName().equals("舒张压")) {
|
|
|
+ content = "血压120/" + resultRule.getRuleBaseInputValue();
|
|
|
+ } else {
|
|
|
+ content = resultRule.getRuleBaseLibName();
|
|
|
+ if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
+ content += resultRule.getRuleBaseInputValue();
|
|
|
+ }
|
|
|
}
|
|
|
billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(),
|
|
|
resultRule.getRuleLibName(),
|
|
@@ -1843,7 +1863,7 @@ public class MedRuleConvertFacade {
|
|
|
* @param max
|
|
|
* @return
|
|
|
*/
|
|
|
- public BigDecimal random(BigDecimal min, BigDecimal max, Boolean minBoundary, Boolean maxBoundary) {
|
|
|
+ public BigDecimal random(BigDecimal min, BigDecimal max, Boolean minBoundary, Boolean maxBoundary,Integer accuracy) {
|
|
|
if (min == null) {
|
|
|
min = BigDecimal.ZERO;
|
|
|
}
|
|
@@ -1851,16 +1871,16 @@ public class MedRuleConvertFacade {
|
|
|
max = min.add(BigDecimal.TEN);
|
|
|
}
|
|
|
BigDecimal randomVal = new BigDecimal(Math.random() * (max.doubleValue() - min.doubleValue()) + min.doubleValue());
|
|
|
- BigDecimal random_dec = randomVal.setScale(3, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal random_dec = randomVal.setScale(accuracy, BigDecimal.ROUND_HALF_UP);
|
|
|
//是否包含边界值
|
|
|
if (!minBoundary) {
|
|
|
if (maxBoundary) {
|
|
|
- if (randomVal.setScale(3, BigDecimal.ROUND_UP).doubleValue() <= max.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) {
|
|
|
- random_dec = randomVal.setScale(3, BigDecimal.ROUND_UP);
|
|
|
+ if (randomVal.setScale(accuracy, BigDecimal.ROUND_UP).doubleValue() <= max.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) {
|
|
|
+ random_dec = randomVal.setScale(accuracy, BigDecimal.ROUND_UP);
|
|
|
}
|
|
|
} else {
|
|
|
- if (randomVal.setScale(3, BigDecimal.ROUND_UP).doubleValue() < max.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) {
|
|
|
- random_dec = randomVal.setScale(3, BigDecimal.ROUND_UP);
|
|
|
+ if (randomVal.setScale(accuracy, BigDecimal.ROUND_UP).doubleValue() < max.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) {
|
|
|
+ random_dec = randomVal.setScale(accuracy, BigDecimal.ROUND_UP);
|
|
|
}
|
|
|
}
|
|
|
}
|