blob: 073701b3706f72f61288b36b72a1893b56bd01c8 (
plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
package com.example.surgerylog;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
public class MedLogRoot implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7337501254153966693L;
private Dictionary<String, MedLogType> _typeDictionary = new Hashtable<String, MedLogType>();
private List<String> _typeList = new ArrayList<String>();
private List<String> _firsAiderList = new ArrayList<String>();
private List<String> _anesthesiaList = new ArrayList<String>();
private List<String> _placeList = new ArrayList<String>();
public MedLogRoot() {
}
public void GrowTreeWithInfo(MedLogInfo info) {
// try to add new first aider
if (HasFirstAider(info.FirstAider) == false) {
AddFirstAider(info.FirstAider);
}
// try to add new anesthesia
if (HasAnesthesia(info.Anesthesia) == false) {
AddAnesthesia(info.Anesthesia);
}
// try to add new place
if (HasPlace(info.Place) == false) {
AddPlace(info.Place);
}
// try to add new Type
if (HasType(info.Type) == false) {
AddType(info.Type);
}
// Only add branches if has root...
if (HasType(info.Type) == true) {
// get Type
MedLogType type = _typeDictionary.get(info.Type);
// add Type related information
if (type.HasSubType(info.SubType) == false) {
type.AddSubType(info.SubType);
}
// Only add branches if has root...
if (type.HasSubType(info.SubType) == true) {
// get SubType
MedLogSubType subType = type.GetMedLogSubType(info.SubType);
// add SubTyppe related information
if (subType.HasSubSubType(info.SubSubType) == false) {
subType.AddSubSubType(info.SubSubType);
}
if (subType.HasPathology(info.Pathology) == false) {
subType.AddPathology(info.Pathology);
}
if (subType.HasIntervention(info.Intervention) == false) {
subType.AddIntervention(info.Intervention);
}
}
}
}
private Boolean IsValid(String verify) {
return verify.trim().isEmpty() == false;
}
public Boolean HasFirstAider(String firstAider) {
return _firsAiderList.contains(firstAider.trim());
}
public void AddFirstAider(String firstAider) {
if (IsValid(firstAider))
_firsAiderList.add(firstAider.trim());
}
public Boolean HasAnesthesia(String anesthesia) {
return _anesthesiaList.contains(anesthesia.trim());
}
public void AddAnesthesia(String anesthesia) {
if (IsValid(anesthesia))
_anesthesiaList.add(anesthesia.trim());
}
public Boolean HasPlace(String place) {
return _placeList.contains(place.trim());
}
public void AddPlace(String place) {
if (IsValid(place))
_placeList.add(place.trim());
}
public Boolean HasType(String type) {
return _typeList.contains(type.trim());
}
public void AddType(String type) {
if (IsValid(type)) {
String typeTrim = type.trim();
_typeList.add(typeTrim);
MedLogType surgeryType = new MedLogType();
_typeDictionary.put(typeTrim, surgeryType);
}
}
public MedLogType GetMedLogType(String type) {
return _typeDictionary.get(type.trim());
}
public List<String> GetTypeList() {
return _typeList;
}
public List<String> GetFirstAiderList() {
return _firsAiderList;
}
public List<String> GetAnesthesiaList() {
return _anesthesiaList;
}
public List<String> GetPlaceList() {
return _placeList;
}
}
|