阑尾炎诊断程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1. 阑尾炎诊断程序
在一个慢性、急性、穿孔性阑尾炎的诊断过程中,经病理分析,归纳,对于各“体征”会出现几种不同的情况,如表所示。某医院根据7.2例对各体征的各种情况算出出现概率的估计值
32171321,,,,),|(),|(),|(D D D x x D x p D x p D x p i i i 代表七种体征,其中⋯分别表示慢性、急性和穿孔性。又根据病历资料,得到诊断地区三种阑尾炎的发病率)()()(321D P D P D P 、、(可得其定值)
,根据表中提供的各体征的数据,试用贝叶斯统计方法,确定所属哪一类病。(提示:计算
∑=⋯⋯=
⋯3
1
71
7171)
|()|()()
|()|()()|(j i i i
i i i I D x p D x
p D P D x p D x p D P x x D P )
例如上腹疼,则知111213(|)15%,(|)29%,(|)42%p x D p x D p x D === 程序界面如图:
七种症状各用一个单选框进行确定,默认均为第一个选择。三个文本框用以
输入本地区已知的三种阑尾炎的发病率,即公式中的)()()(321D P D P D P 、、。i =1~3,对应的)|(71x x D P I 取值不同,取i 中最大的一个。程序代码如下:
Dim sum(6, 2), tz1(4, 2) As Single, tz2(2, 2), tz3(2, 2), tz4(1, 2),
tz5(2, 2), tz6(2, 2), tz7(2, 2) As Single Private Sub Command1_Click() For i = 0 To 4
If Option1(i).Value = True Then
sum(0, 0) = tz1(i, 0): sum(0, 1) = tz1(i, 1): sum(0, 2) = tz1(i, 2)
End If Next
For i = 0 To 2
If Option2(i).Value = True Then
sum(1, 0) = tz2(i, 0): sum(1, 1) = tz2(i, 1): sum(1, 2) = tz2(i, 2)
End If Next
For i = 0 To 2
If Option3(i).Value = True Then
sum(2, 0) = tz3(i, 0): sum(2, 1) = tz3(i, 1): sum(2, 2) = tz3(i, 2)
End If Next
For i = 0 To 1
If Option4(i).Value = True Then
sum(3, 0) = tz4(i, 0): sum(3, 1) = tz4(i, 1): sum(3, 2) = tz4(i, 2)
End If Next
For i = 0 To 2
If Option5(i).Value = True Then
sum(4, 0) = tz5(i, 0): sum(4, 1) = tz5(i, 1): sum(4, 2) = tz5(i, 2)
End If Next
For i = 0 To 2
If Option6(i).Value = True Then
sum(5, 0) = tz6(i, 0): sum(5, 1) = tz6(i, 1): sum(5, 2) = tz6(i, 2)
End If Next
For i = 0 To 2
If Option7(i).Value = True Then
sum(6, 0) = tz7(i, 0): sum(6, 1) = tz7(i, 1): sum(6, 2) = tz7(i, 2)
End If
Next
For i = 0 To 2
If Text1(i).Text = "" Then
MsgBox "请输入已知的本地区发病率!", 16, "错误"
Exit Sub
End If
Next
For i = 0 To 2
If Text1(i).Text > 1 Or Text1(i).Text < 0 Then
MsgBox "请输入正确的数值!", 16, "错误"
Exit Sub
End If
Next
Dim PDX, P(2), PD(2), P3 As Single
For i = 0 To 2
PD(i) = Text1(i).Text
Next
For i = 0 To 2
P(i) = PD(i) * sum(0, i) * sum(1, i) * sum(2, i) * sum(3, i) * sum(4, i) * sum(5, i) * sum(6, i)
Next
P3 = P(0) + P(1) + P(2)
P(0) = P(0) / P3: P(1) = P(1) / P3: P(2) = P(2) / P3
If P(0) >= P(1) Then
If P(1) >= P(2) Then
PDX = P(0): Text2.Text = "慢性阑尾炎"
Else: PDX = P(2): Text2.Text = "穿孔性阑尾炎"
End If
ElseIf P(1) >= P(2) Then
PDX = P(1): Text2.Text = "急性阑尾炎"
Else: PDX = P(2): Text2.Text = "穿孔性阑尾炎"
End If
End Sub
Private Sub Command2_Click()
Unload Form1
Load Form2
Form2.Show
End Sub