source: Scheduling/trunk/cs/bsdx0200GUISourceCode/DPatientLookup.cs@ 1328

Last change on this file since 1328 was 1125, checked in by Sam Habiel, 14 years ago

CGView: Appointment Object now has Patient subobject created for routing slip information.
DPatientLookup: Now returns DOB as well.
Routing Slip doesn't print Sex anymore.
Updated Release Exes.

File size: 11.3 KB
RevLine 
[614]1using System;
2using System.Windows.Forms;
3using System.Data;
4
[1097]5
[614]6namespace IndianHealthService.ClinicalScheduling
7{
8 /// <summary>
9 /// Summary description for DPatientLookup.
10 /// </summary>
11 public class DPatientLookup : System.Windows.Forms.Form
12 {
13 private System.Windows.Forms.Panel panel1;
14 private System.Windows.Forms.Button cmdCancel;
15 private System.Windows.Forms.Button cmdOK;
16 private System.Windows.Forms.Panel panel2;
17 private System.Windows.Forms.Button cmdSearch;
18 private System.Windows.Forms.TextBox txtSearch;
19 private System.Windows.Forms.Panel panel3;
20 private System.Windows.Forms.ListView lvwPatients;
21 /// <summary>
22 /// Required designer variable.
23 /// </summary>
24 private System.ComponentModel.Container components = null;
25
26 public DPatientLookup()
27 {
28 this.m_sPatientName = "";
29 this.m_sPatientIEN = "";
30 m_nMax = 20;
31 InitializeComponent();
32 }
33
34 #region Windows Form Designer generated code
35 /// <summary>
36 /// Required method for Designer support - do not modify
37 /// the contents of this method with the code editor.
38 /// </summary>
39 private void InitializeComponent()
40 {
41 this.panel1 = new System.Windows.Forms.Panel();
42 this.cmdCancel = new System.Windows.Forms.Button();
43 this.cmdOK = new System.Windows.Forms.Button();
44 this.panel2 = new System.Windows.Forms.Panel();
45 this.cmdSearch = new System.Windows.Forms.Button();
46 this.txtSearch = new System.Windows.Forms.TextBox();
47 this.panel3 = new System.Windows.Forms.Panel();
48 this.lvwPatients = new System.Windows.Forms.ListView();
49 this.panel1.SuspendLayout();
50 this.panel2.SuspendLayout();
51 this.panel3.SuspendLayout();
52 this.SuspendLayout();
53 //
54 // panel1
55 //
56 this.panel1.Controls.Add(this.cmdCancel);
57 this.panel1.Controls.Add(this.cmdOK);
58 this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
59 this.panel1.Location = new System.Drawing.Point(0, 238);
60 this.panel1.Name = "panel1";
61 this.panel1.Size = new System.Drawing.Size(384, 40);
62 this.panel1.TabIndex = 2;
63 //
64 // cmdCancel
65 //
66 this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
67 this.cmdCancel.Location = new System.Drawing.Point(304, 8);
68 this.cmdCancel.Name = "cmdCancel";
69 this.cmdCancel.Size = new System.Drawing.Size(64, 24);
70 this.cmdCancel.TabIndex = 1;
71 this.cmdCancel.Text = "Cancel";
72 //
73 // cmdOK
74 //
75 this.cmdOK.DialogResult = System.Windows.Forms.DialogResult.OK;
76 this.cmdOK.Location = new System.Drawing.Point(224, 8);
77 this.cmdOK.Name = "cmdOK";
78 this.cmdOK.Size = new System.Drawing.Size(64, 24);
79 this.cmdOK.TabIndex = 0;
80 this.cmdOK.Text = "OK";
81 this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click);
82 //
83 // panel2
84 //
85 this.panel2.Controls.Add(this.cmdSearch);
86 this.panel2.Controls.Add(this.txtSearch);
87 this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
88 this.panel2.Location = new System.Drawing.Point(0, 0);
89 this.panel2.Name = "panel2";
90 this.panel2.Size = new System.Drawing.Size(384, 40);
91 this.panel2.TabIndex = 5;
92 //
93 // cmdSearch
94 //
95 this.cmdSearch.Location = new System.Drawing.Point(288, 8);
96 this.cmdSearch.Name = "cmdSearch";
97 this.cmdSearch.Size = new System.Drawing.Size(80, 24);
98 this.cmdSearch.TabIndex = 5;
99 this.cmdSearch.Text = "Search";
100 this.cmdSearch.Click += new System.EventHandler(this.cmdSearch_Click);
101 //
102 // txtSearch
103 //
104 this.txtSearch.Location = new System.Drawing.Point(16, 8);
105 this.txtSearch.Name = "txtSearch";
106 this.txtSearch.Size = new System.Drawing.Size(216, 20);
107 this.txtSearch.TabIndex = 4;
108 this.txtSearch.Text = "";
109 this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged);
110 //
111 // panel3
112 //
113 this.panel3.Controls.Add(this.lvwPatients);
114 this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
115 this.panel3.Location = new System.Drawing.Point(0, 40);
116 this.panel3.Name = "panel3";
117 this.panel3.Size = new System.Drawing.Size(384, 198);
118 this.panel3.TabIndex = 6;
119 //
120 // lvwPatients
121 //
122 this.lvwPatients.AllowColumnReorder = true;
123 this.lvwPatients.Dock = System.Windows.Forms.DockStyle.Fill;
124 this.lvwPatients.FullRowSelect = true;
125 this.lvwPatients.GridLines = true;
126 this.lvwPatients.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
127 this.lvwPatients.Location = new System.Drawing.Point(0, 0);
128 this.lvwPatients.MultiSelect = false;
129 this.lvwPatients.Name = "lvwPatients";
130 this.lvwPatients.Size = new System.Drawing.Size(384, 198);
131 this.lvwPatients.Sorting = System.Windows.Forms.SortOrder.Ascending;
132 this.lvwPatients.TabIndex = 5;
133 this.lvwPatients.View = System.Windows.Forms.View.Details;
134 this.lvwPatients.ItemActivate += new System.EventHandler(this.lvwPatients_ItemActivate);
135 //
136 // DPatientLookup
137 //
138 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
139 this.CancelButton = this.cmdCancel;
140 this.ClientSize = new System.Drawing.Size(384, 278);
141 this.Controls.Add(this.panel3);
142 this.Controls.Add(this.panel2);
143 this.Controls.Add(this.panel1);
144 this.Name = "DPatientLookup";
145 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
146 this.Text = "Select Patient";
147 this.Load += new System.EventHandler(this.DPatientLookup_Load);
148 this.Activated += new System.EventHandler(this.DPatientLookup_Activated);
149 this.panel1.ResumeLayout(false);
150 this.panel2.ResumeLayout(false);
151 this.panel3.ResumeLayout(false);
152 this.ResumeLayout(false);
153
154 }
155 #endregion
156
157 #region Fields
158
159 private string m_sPatientName;
160 private DataTable m_rsPatients;
161 private CGDocumentManager m_DocManager;
162 private int m_nMax;
163 private string m_sPatientHRN = "";
164 private string m_sPatientIEN;
165 private string m_sPatientDOB;
[868]166 private string m_sPatientPID;
[614]167
168 #endregion //Fields
169
170 #region Methods
171
172 /// <summary>
173 /// Clean up any resources being used.
174 /// </summary>
175 protected override void Dispose( bool disposing )
176 {
177 if( disposing )
178 {
179 if(components != null)
180 {
181 components.Dispose();
182 }
183 }
184 base.Dispose( disposing );
185 }
186
187 private void cmdOK_Click(object sender, System.EventArgs e)
188 {
189 if (this.txtSearch.Text == "")
190 {
191 this.DialogResult = DialogResult.Cancel;
192 return;
193 }
194 m_sPatientName = this.txtSearch.Text;
195
196 //Update spacebar lookup value
197 string sSql;
198 sSql = "BSDX SPACEBAR SET^AUPNPAT(^" + m_sPatientIEN;
199 DataTable dtAppt = m_DocManager.RPMSDataTable(sSql, "SpaceBarValue");
200 return;
201 }
202
203 private void cmdSearch_Click(object sender, System.EventArgs e)
204 {
205 try
206 {
207 string sSearch = txtSearch.Text;
208 if (sSearch == "")
209 return;
210 this.lvwPatients.Clear();
211 m_rsPatients = this.GetPatientLookupRS(sSearch, m_nMax);
212
213 if (m_rsPatients.Rows.Count == 0)
214 {
215 MessageBox.Show("No matching Patients Found.");
216 this.txtSearch.Focus();
217 return;
218 }
219
220 if (m_rsPatients.Rows.Count == 1)
221 {
222 DataRow r = m_rsPatients.Rows[0];
223 this.m_sPatientName = r["NAME"].ToString();
224 txtSearch.Text = this.m_sPatientName;
225 this.m_sPatientHRN = r["HRN"].ToString();
226 this.m_sPatientIEN = r["IEN"].ToString();
[868]227 this.m_sPatientPID = r["PID"].ToString();
[1125]228 DateTime d = Convert.ToDateTime(r["DOB"]);
229 string sFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
230 this.m_sPatientDOB = d.ToString(sFormat);
[614]231 this.cmdOK.Enabled = true;
232 this.AcceptButton = cmdOK;
233 this.cmdOK.Focus();
234 }
235 lvwPatients.View = View.Details;
236
237 foreach (DataRow r in m_rsPatients.Rows)
238 {
239 string sPat = r["NAME"].ToString();
240 ListViewItem lv = new ListViewItem(sPat);
241 lv.SubItems.Add(r["HRN"].ToString());
[868]242 lv.SubItems.Add(r["PID"].ToString());
[614]243 DateTime d = Convert.ToDateTime(r["DOB"]);
[868]244 string sFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
245 string sDob = d.ToString(sFormat);
[614]246 lv.SubItems.Add(sDob);
247 lv.SubItems.Add((r["IEN"].ToString()));
248 lvwPatients.Items.Add(lv);
249 }
250
251 lvwPatients.View = View.Details;
252 int w =-1;
253 lvwPatients.Columns.Add("Name", w, HorizontalAlignment.Left);
254 lvwPatients.Columns.Add("HRN", w, HorizontalAlignment.Left);
[868]255 lvwPatients.Columns.Add("PID", w, HorizontalAlignment.Left);
[614]256 lvwPatients.Columns.Add("DOB",w, HorizontalAlignment.Left);
257
258 lvwPatients.Columns[0].Width = -1;
259 lvwPatients.Columns[1].Width = -1;
260 lvwPatients.Columns[2].Width = -1;
261 lvwPatients.Columns[3].Width = -1;
262 lvwPatients.Select();
263 lvwPatients.Items[0].Selected = true;
264 lvwPatients.Focus();
265 }
266 catch (Exception ex)
267 {
[620]268 MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
[614]269 }
270 }
271
272 private DataTable GetPatientLookupRS(string sLookup, int nMax)
273 {
274 string sSql;
275 sSql = "BSDXPatientLookupRS^" + sLookup + "^" + nMax.ToString();
276 System.Data.DataTable tb = m_DocManager.RPMSDataTable(sSql, "PatientTable");
277 return tb;
278
279 }
280
281 private void lvwPatients_Click(object sender, System.EventArgs e)
282 {
283
284 }
285
286 private void lvwPatients_ItemActivate(object sender, System.EventArgs e)
287 {
288 ListViewItem v = lvwPatients.SelectedItems[0]; //only one can be selected
289 m_sPatientName = v.SubItems[0].Text;
290 m_sPatientIEN = v.SubItems[4].Text;
291 m_sPatientHRN = v.SubItems[1].Text;
292 m_sPatientDOB = v.SubItems[3].Text;
[868]293 m_sPatientPID = v.SubItems[2].Text;
[614]294 this.txtSearch.Text = m_sPatientName;
295 this.cmdOK.Enabled = true;
296 this.cmdOK.Focus();
297 }
298
299 private void txtSearch_TextChanged(object sender, System.EventArgs e)
300 {
301 this.cmdOK.Enabled = false;
302 this.AcceptButton = cmdSearch;
303 }
304
305 private void DPatientLookup_Load(object sender, System.EventArgs e)
306 {
307 }
308
309 private void DPatientLookup_Activated(object sender, System.EventArgs e)
310 {
311 System.IntPtr pHandle = this.Handle;
312 this.cmdOK.Enabled = false;
313 this.txtSearch.Focus();
314
315 }
316
317 #endregion //Methods
318
319 #region Properties
320
321 /// <summary>
322 /// Gets or sets the name of the selected patient
323 /// </summary>
324 public string PatientName
325 {
326 get
327 {
328 return m_sPatientName;
329 }
330 set
331 {
332 m_sPatientName = value;
333 }
334 }
335
336 public CGDocumentManager DocManager
337 {
338 get
339 {
340 return m_DocManager;
341 }
342 set
343 {
344 m_DocManager = value;
345 }
346 }
347
348 /// <summary>
349 /// RPMS Internal Entry Number in PATIENT file (DFN)
350 /// </summary>
351 public string PatientIEN
352 {
353 get
354 {
355 return this.m_sPatientIEN;
356 }
357 }
358
359 /// <summary>
360 /// The string representation of the Health Record Number
361 /// </summary>
362 public string HealthRecordNumber
363 {
364 get
365 {
366 return m_sPatientHRN;
367 }
368 set
369 {
370 m_sPatientHRN = value;
371 }
372 }
373
[1125]374 public DateTime PatientDOB
375 {
376 get
377 {
378 return DateTime.Parse(m_sPatientDOB);
379 }
380 }
381
382 public string PatientPID
383 {
384 get
385 {
386 return m_sPatientPID;
387 }
388 }
389
[614]390 #endregion //Properties
391
392 }
393}
Note: See TracBrowser for help on using the repository browser.