-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMedical.pl
90 lines (80 loc) · 2.55 KB
/
Medical.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
:- dynamic patient/2.
symptom('Flu').
symptom('Yellowish eyes and skin').
symptom('Dark color urine').
symptom('Pale bowel movement').
symptom('Fatigue').
symptom('Vomitting').
symptom('Fever').
symptom('Pain in joints').
symptom('Weakness').
symptom('Stomach Pain').
treatment('Flu', 'Drink hot water, avoid cold eatables.').
treatment('Yellowish eyes and skin', 'Put eye drops, have healthy sleep, do not strain your eyes.').
treatment('Dark color urine', 'Drink lots of water, juices and eat fruits. Avoid alcohol consumption.').
treatment('Pale bowel movement', 'Drink lots of water and exercise regularly.').
treatment('Fatigue', 'Drink lots of water, juices and eat fruits.').
treatment('Vomitting', 'Drink salt and water.').
treatment('Fever', 'Put hot water cloth on head and take crocin.').
treatment('Pain in Joints', 'Apply pain killer and take crocin.').
treatment('Weakness', 'Drink salt and water, eat fruits.').
treatment('Stomach Pain', 'Avoid outside food and eat fruits.').
input :-
repeat,
symptom(X),
write('Does the patient have '),
write(X),
write('? '),
read(Y),
assert(patient(X,Y)),
\+ not(X='Stomach Pain'),
not(output).
disease(hemochromatosis) :-
patient('Stomach Pain',yes),
patient('Pain in joints',yes),
patient('Weakness',yes),
patient('Dark color urine',yes),
patient('Yellowish eyes and skin',yes).
disease(hepatitis_c) :-
not(disease(hemochromatosis)),
patient('Pain in joints',yes),
patient('Fever',yes),
patient('Fatigue',yes),
patient('Vomitting',yes),
patient('Pale bowel movement',yes).
disease(hepatitis_b) :-
not(disease(hemochromatosis)),
not(disease(hepatitis_c)),
patient('Pale bowel movement',yes),
patient('Dark color urine',yes),
patient('Yellowish eyes and skin',yes).
disease(hepatitis_a) :-
not(disease(hemochromatosis)),
not(disease(hepatitis_c)),
not(disease(hepatitis_b)),
patient('Flu',yes),
patient('Yellowish eyes and skin',yes).
disease(jaundice) :-
not(disease(hemochromatosis)),
not(disease(hepatitis_c)),
not(disease(hepatitis_b)),
not(disease(hepatitis_a)),
patient('Yellowish eyes and skin',yes).
disease(flu) :-
not(disease(hemochromatosis)),
not(disease(hepatitis_c)),
not(disease(hepatitis_b)),
not(disease(hepatitis_a)),
patient('Flu',yes).
possible_diseases :-
disease(X),
write('The patient may suffer from '),
write(X),no
nl.
advice :-
symptom(X),
patient(X,yes),
treatment(X,Y),
write(Y),
nl,
\+ not(X='Stomach Pain').