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

Last change on this file since 1097 was 1097, checked in by Sam Habiel, 13 years ago

DPatientLookup.cs: Usings Cleanup
DApptSearch: Extensive refactoring. Now uses new algorithm to find appointments. Now outputs CGAvailability
CGView: Appointments checked in now set the Checkin time on the appointment structure; changes to support DApptSearch modified output.
CGSchedLib: Extensive refactoring; only 2 methods remain: CreateAppointmentSchedule and CreateAvailabilitySchedule
CGDocument: SlotsAvailable uses a new algorithm
CGAVView: Uses CalendarGrid.TimesOverlap instead of the removed one in CGSchedLib
CGAVDocument: Uses CalendarGrid.TimesOverlap instead of the removed one in CGSchedLib; CreateAssignedSlotSchedule reassigned to CreateAvailabilitySchedule

File size: 10.8 KB
Line 
1using System;
2using System.Windows.Forms;
3using System.Data;
4
5
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;
166 private string m_sPatientPID;
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();
227 this.m_sPatientPID = r["PID"].ToString();
228 this.cmdOK.Enabled = true;
229 this.AcceptButton = cmdOK;
230 this.cmdOK.Focus();
231 }
232 lvwPatients.View = View.Details;
233
234 foreach (DataRow r in m_rsPatients.Rows)
235 {
236 string sPat = r["NAME"].ToString();
237 ListViewItem lv = new ListViewItem(sPat);
238 lv.SubItems.Add(r["HRN"].ToString());
239 lv.SubItems.Add(r["PID"].ToString());
240 DateTime d = Convert.ToDateTime(r["DOB"]);
241 string sFormat = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
242 string sDob = d.ToString(sFormat);
243 lv.SubItems.Add(sDob);
244 lv.SubItems.Add((r["IEN"].ToString()));
245 lvwPatients.Items.Add(lv);
246 }
247
248 lvwPatients.View = View.Details;
249 int w =-1;
250 lvwPatients.Columns.Add("Name", w, HorizontalAlignment.Left);
251 lvwPatients.Columns.Add("HRN", w, HorizontalAlignment.Left);
252 lvwPatients.Columns.Add("PID", w, HorizontalAlignment.Left);
253 lvwPatients.Columns.Add("DOB",w, HorizontalAlignment.Left);
254
255 lvwPatients.Columns[0].Width = -1;
256 lvwPatients.Columns[1].Width = -1;
257 lvwPatients.Columns[2].Width = -1;
258 lvwPatients.Columns[3].Width = -1;
259 lvwPatients.Select();
260 lvwPatients.Items[0].Selected = true;
261 lvwPatients.Focus();
262 }
263 catch (Exception ex)
264 {
265 MessageBox.Show(this, ex.Message, "Clinical Scheduling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
266 }
267 }
268
269 private DataTable GetPatientLookupRS(string sLookup, int nMax)
270 {
271 string sSql;
272 sSql = "BSDXPatientLookupRS^" + sLookup + "^" + nMax.ToString();
273 System.Data.DataTable tb = m_DocManager.RPMSDataTable(sSql, "PatientTable");
274 return tb;
275
276 }
277
278 private void lvwPatients_Click(object sender, System.EventArgs e)
279 {
280
281 }
282
283 private void lvwPatients_ItemActivate(object sender, System.EventArgs e)
284 {
285 ListViewItem v = lvwPatients.SelectedItems[0]; //only one can be selected
286 m_sPatientName = v.SubItems[0].Text;
287 m_sPatientIEN = v.SubItems[4].Text;
288 m_sPatientHRN = v.SubItems[1].Text;
289 m_sPatientDOB = v.SubItems[3].Text;
290 m_sPatientPID = v.SubItems[2].Text;
291 this.txtSearch.Text = m_sPatientName;
292 this.cmdOK.Enabled = true;
293 this.cmdOK.Focus();
294 }
295
296 private void txtSearch_TextChanged(object sender, System.EventArgs e)
297 {
298 this.cmdOK.Enabled = false;
299 this.AcceptButton = cmdSearch;
300 }
301
302 private void DPatientLookup_Load(object sender, System.EventArgs e)
303 {
304 }
305
306 private void DPatientLookup_Activated(object sender, System.EventArgs e)
307 {
308 System.IntPtr pHandle = this.Handle;
309 this.cmdOK.Enabled = false;
310 this.txtSearch.Focus();
311
312 }
313
314 #endregion //Methods
315
316 #region Properties
317
318 /// <summary>
319 /// Gets or sets the name of the selected patient
320 /// </summary>
321 public string PatientName
322 {
323 get
324 {
325 return m_sPatientName;
326 }
327 set
328 {
329 m_sPatientName = value;
330 }
331 }
332
333 public CGDocumentManager DocManager
334 {
335 get
336 {
337 return m_DocManager;
338 }
339 set
340 {
341 m_DocManager = value;
342 }
343 }
344
345 /// <summary>
346 /// RPMS Internal Entry Number in PATIENT file (DFN)
347 /// </summary>
348 public string PatientIEN
349 {
350 get
351 {
352 return this.m_sPatientIEN;
353 }
354 }
355
356 /// <summary>
357 /// The string representation of the Health Record Number
358 /// </summary>
359 public string HealthRecordNumber
360 {
361 get
362 {
363 return m_sPatientHRN;
364 }
365 set
366 {
367 m_sPatientHRN = value;
368 }
369 }
370
371 #endregion //Properties
372
373 }
374}
Note: See TracBrowser for help on using the repository browser.