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