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