|
@@ -7,7 +7,8 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import org.dromara.common.core.constant.BizConst;
|
|
|
-import org.dromara.common.core.enums.PaymentStatus;
|
|
|
+import org.dromara.common.core.enums.biz.PaymentStatus;
|
|
|
+import org.dromara.common.core.enums.biz.QuestionsList;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
@@ -157,29 +158,37 @@ public class NutritionScreeningServiceImpl implements INutritionScreeningService
|
|
|
}
|
|
|
SysScreeningAssessmentConfigBo configBo = JSON.parseObject(bo.getContent(), new TypeReference<SysScreeningAssessmentConfigBo>() {
|
|
|
});
|
|
|
- if (CollUtil.isEmpty(configBo.getOtherInfo())) {
|
|
|
+ if (CollUtil.isEmpty(configBo.getOtherInfo()) && ObjUtil.isEmpty(configBo.getBaseInfo())) {
|
|
|
throw new ServiceException("没有任何“营养筛查”!");
|
|
|
}
|
|
|
|
|
|
BigDecimal total = BigDecimal.ZERO;
|
|
|
- for (SysScreeningAssessmentQuestionBo questionBo : configBo.getOtherInfo()) {
|
|
|
- if (ObjUtil.isNull(questionBo.getValue())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if (CollUtil.isNotEmpty(configBo.getOtherInfo())) {
|
|
|
+ for (SysScreeningAssessmentQuestionBo questionBo : configBo.getOtherInfo()) {
|
|
|
+ if (ObjUtil.isNull(questionBo.getValue())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- List<Integer> valueList = CollUtil.newArrayList();
|
|
|
- String obj = String.valueOf(questionBo.getValue());
|
|
|
- if (NumberUtil.isNumber(obj)) {
|
|
|
- valueList.add(Integer.valueOf(obj));
|
|
|
- } else {
|
|
|
- List objList = (List) questionBo.getValue();
|
|
|
- objList.forEach(v -> valueList.add(Integer.valueOf(String.valueOf(v))));
|
|
|
- }
|
|
|
+ List<Integer> valueList = CollUtil.newArrayList();
|
|
|
+ boolean pass = QuestionsList.QUESTION_TYPE_SELECTION.getCode().equals(questionBo.getQuestionType()) ||
|
|
|
+ (QuestionsList.ANTHROPOMETRY.getCode().equals(questionBo.getQuestionType()) && QuestionsList.ANTHROPOMETRY_CHILD_FOUR.getCode().equals(questionBo.getLastType())) ||
|
|
|
+ (QuestionsList.DIETARY_STATUS.getCode().equals(questionBo.getQuestionType()) && QuestionsList.DIETARY_STATUS_CHILD_TWO.getCode().equals(questionBo.getLastType()));
|
|
|
+ if (!pass) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String obj = String.valueOf(questionBo.getValue());
|
|
|
+ if (NumberUtil.isNumber(obj)) {
|
|
|
+ valueList.add(Integer.valueOf(obj));
|
|
|
+ } else {
|
|
|
+ List objList = (List) questionBo.getValue();
|
|
|
+ objList.forEach(v -> valueList.add(Integer.valueOf(String.valueOf(v))));
|
|
|
+ }
|
|
|
|
|
|
- for (Integer index : valueList) {
|
|
|
- SysScreeningAssessmentQuestionBo.QuestionAttrBo attrBo = questionBo.getContentList().get(index);
|
|
|
- if (StrUtil.isNotBlank(attrBo.getScore()) && NumberUtil.isNumber(attrBo.getScore())) {
|
|
|
- total = total.add(new BigDecimal(attrBo.getScore()));
|
|
|
+ for (Integer index : valueList) {
|
|
|
+ SysScreeningAssessmentQuestionBo.QuestionAttrBo attrBo = questionBo.getContentList().get(index);
|
|
|
+ if (StrUtil.isNotBlank(attrBo.getScore()) && NumberUtil.isNumber(attrBo.getScore())) {
|
|
|
+ total = total.add(new BigDecimal(attrBo.getScore()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|