1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 try:
24 import wxversion
25 import wx
26 except ImportError:
27 from wxPython import wx
28
29 import gmGuiElement_HeadingCaptionPanel
30 import gmGuiElement_DividerCaptionPanel
31 import gmGuiElement_AlertCaptionPanel
32 import gmEditArea
33 import gmPlugin_Patient
34
35 import gmDispatcher
36
37 from gmPatientHolder import PatientHolder
38 import gmPatientHolder
39
40 from gmListCtrlMapper import gmListCtrlMapper
41
42 import gmMultiColumnList
43
44 ID_SIGNIFICANTPASTHISTORYLIST = wxNewId()
45 ID_ACTIVEPROBLEMLIST = wxNewId()
46 gmSECTION_PASTHISTORY = 5
47
48
49
50 activehistorydata = {
51 1 : ("1982","Hypertension"),
52 2 : ("1990","Ischaemic Heart Disease"),
53 3 : ("1995","NIDDM"),
54 4 : ("1998","Lymphoma"),
55 5:("1998","Chemotherapy"),
56 }
57 significanthistorydata = {
58 1 : ("1982","Hypertension"),
59 2 : ("1990","Acute myocardial infarction"),
60 3 : ("1994","CABG"),
61 4 : ("1995","Cholecystectomy"),
62 }
63
64 pasthistoryprompts = {
65 1:("Condition"),
66 2:("Notes"),
67 3:(""),
68 4:("Age Onset"),
69 5:("Year Onset"),
70 6:(""),
71 7:("Progress Notes"),
72 8:(""),
73 }
74
75
76
77 -class PastHistoryPanel(wxPanel, PatientHolder):
78 - def __init__(self, parent,id):
79 wxPanel.__init__(self, parent, id,wxDefaultPosition,wxDefaultSize,wxRAISED_BORDER)
80 PatientHolder.__init__(self)
81
82
83
84
85 self.pasthistorypanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1, " PAST HISTORY ")
86
87
88
89 self.dummypanel1 = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0)
90 self.dummypanel1.SetBackgroundColour(wxColor(222,222,222))
91
92
93
94
95 self.editarea = gmEditArea.gmPastHistoryEditArea(self,-1)
96 self.dummypanel2 = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0)
97 self.dummypanel2.SetBackgroundColour(wxColor(222,222,222))
98
99
100
101 self.significant_history_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Significant Past Problems"))
102 self.sizer_significant_history_heading = wxBoxSizer(wxHORIZONTAL)
103 self.sizer_significant_history_heading.Add(self.significant_history_heading,1, wxEXPAND)
104
105
106
107
108
109
110
111
112
113
114 self.significant_problem_list = gmMultiColumnList.MultiColumnList(self, -1)
115 self.significant_problem_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
116
117 self.active_problem_list = gmMultiColumnList.MultiColumnList(self, -1)
118 self.active_problem_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
119
120
121
122
123
124
125
126
127
128
129
130
131
132 self.significant_problem_list.SetData( significanthistorydata)
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155 self.active_problem_list.SetData( activehistorydata)
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170 self.active_problems_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Active Problems"))
171
172
173
174 self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1," Alerts ")
175
176
177
178 self.mainsizer = wxBoxSizer(wxVERTICAL)
179 self.mainsizer.Add(self.pasthistorypanelheading,0,wxEXPAND)
180
181 self.mainsizer.Add(self.editarea,6,wxEXPAND)
182
183 self.mainsizer.Add(self.significant_history_heading,0,wxEXPAND)
184 self.mainsizer.Add(self.significant_problem_list,4,wxEXPAND)
185 self.mainsizer.Add(self.active_problems_heading,0,wxEXPAND)
186 self.mainsizer.Add(self.active_problem_list,4,wxEXPAND)
187 self.mainsizer.Add(self.alertpanel,0,wxEXPAND)
188 self.SetSizer(self.mainsizer)
189 self.mainsizer.Fit
190 self.SetAutoLayout(True)
191 self.Show(True)
192
193 gmDispatcher.connect(self._updateUI, u'clin_history_updated')
194
195 self.significant_problem_list.addItemListener( self._significantPastItemSelected)
196
197 self.active_problem_list.addItemListener(self._activePastItemSelected)
198
200 clinical = self.get_past_history()
201 self._historyItemSelected( event ,clinical.get_significant_past_history() )
202
203 - def _activePastItemSelected( self, event):
204 clinical = self.get_past_history()
205 self._historyItemSelected( event ,clinical.get_active_history() )
206
207 - def _historyItemSelected( self, event, list):
208 (selId, str) = event['item']
209 for (id, map) in list:
210 if id == selId:
211 clinical = self.get_past_history()
212 self.editarea.setInputFieldValues(map, id)
213
214
215 - def _updateUI(self):
216 clinical = self.get_past_history()
217 significant_past = clinical.get_significant_past_history()
218 active_hx = clinical.get_active_history()
219 self.active_problem_list.SetData( self._get_list_map( active_hx) , fitClientSize = 1)
220
221 self.significant_problem_list.SetData( self._get_list_map( significant_past), fitClientSize = 1 )
222
223
224 - def _get_list_map(self, clin_history_list):
225 newMap = {}
226 for (id, map) in clin_history_list:
227 newMap[id] = self.get_past_history().short_format(map)
228 return newMap
229
230
231
232
233
234
235 -class gmGP_PastHistory(gmPlugin_Patient.wxPatientPlugin):
236 """Plugin to encapsulate the immunisation window."""
237
238 __icons = {
239 """icon_hx_ship""": 'x\xdaU\x8e1\x0b\x830\x10\x85\xf7\xfe\x8a\x80\x82\x85@\xa8K\xb5\xdb\x11\xc1\
240 \xb17\xb8\xbcU\xa4S\xa5\xe9\xff\x9fz\x97\xc44^$\xe4{w\xef\x9d\xd7\xfd\xdb_\
241 \x96\xae\xbf\x1b\xf9\x1e\xa6\xef.\xeb\xd2\xc1l\xc6\xef\xeb\xf6\x8ed\x85\x9a\
242 \x9b\xd40F&\xe5a\x1c\xa6\xcc\xcd\xd1\x9f\x13\x9b\xd4W%r\x10~\x86\xcf+\x02ks\
243 \x1e\xe7)\x0f\xbb\xc4e\xb8U\xf6\xa3\x9f|\x0es\xce\x18H\x85T)1\x00\xcc\x8c \
244 \x07\x95\x18\xc0\x80e\xab\x8d"\x12\xac\xd8\x1b\x96\xc7_\xb42\x198\xe7Vv&9\
245 \xda\xab\xec\x00\x11\xceb\x8c\xc4\xc9\x1e\x87H\x02P-\x92\x1dm\xfaU\xb0@\x11I\
246 E\xbd\x08\x95\x1d\xf9:\xeci\x83\x84\xe6my\xb2\xae\xb2\xe8\xa4e\xbb\xadO\x14\
247 \xdd\x0f&\xf7\x8a\xe4'
248 }
249
251 return 'Pasthistory Window'
252
254 return ('view', '&Past History')
255
256 - def GetIconData(self, anIconID = None):
257 if anIconID == None:
258 return self.__icons[_("""icon_hx_ship""")]
259 else:
260 if self.__icons.has_key(anIconID):
261 return self.__icons[anIconID]
262 else:
263 return self.__icons[_("""icon_hx_ship""")]
264
267
268 if __name__ == "__main__":
269 app = wxPyWidgetTester(size = (600, 600))
270 app.SetWidget(PastHistoryPanel, -1)
271 app.MainLoop()
272