规则定义如何实现
如有A,B,C,D,X项目
条件 结果
规则1:A> 0 and B=0 and C=0 X=正常
规则2:A> 0 and B=1 and C=0 X=不正常
规则3:A> 0 and B=0 and C=1 and D> 0 X=偏高
条件和结果都是记录在数据库中并且可以修改的,如何通过程序和数据库实现结果的输出?
[解决办法]
有规则就按照规则直接写了.
条件 结果
规则1:A> 0 and B=0 and C=0 X=正常
规则2:A> 0 and B=1 and C=0 X=不正常
规则3:A> 0 and B=0 and C=1 and D> 0 X=偏高
IF (A> 0) AND (B=0) AND (C=0) THEN X= "正常 "
IF (A> 0) AND (B=1) AND (C=0) THEN X= "不正常 "
IF (A> 0) AND (B=0) AND (C=1) AND (D> 0) THEN X= "偏高 "
[解决办法]
if a> 0 then
if b=0 then
if c=0 then
x= "正常 "
else
if c=1 and d> 0 then
x= "偏高 "
end if
end if
else
if b=1 and c=0 then
x= "不正常 "
end if
end if
end if