Subversion Repository Public Repository

KNH_Project

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcarecommonutil.views;

import com.bestray.healthcarecommonutil.ContextLoading;
import com.bestray.healthcarecommonutil.controller.ReferralController;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.AutoSuggestorDoctor;
import com.bestray.healthcarecommonutil.util.DisabledGlassPane;
import com.bestray.healthcarecommonutil.util.Initcap;
import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.vo.TCCodeValues;
import com.bestray.healthcarecommonutil.vo.TDiagnosisMaster;
import com.bestray.healthcarecommonutil.vo.TDoctorInformation;
import com.bestray.healthcarecommonutil.vo.TReferral;
import java.awt.event.ActionEvent;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author user3
 */
public class ReferralDialog extends javax.swing.JDialog {

    /**
     * Creates new form ReferralDialog
     */
    public ReferralDialog(java.awt.Frame parent, boolean modal,TReferral referal) {
        super(parent, modal);
        populate();
        initComponents();
        this.setLocationRelativeTo(null);
        this.setResizable(false);
        if(referal!=null){
            this.referalinfo = referal;
            showreferalinfo(referalinfo);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        referedbycombo = new javax.swing.JComboBox();
        referedtocombo = new javax.swing.JComboBox();
        jPanel1 = new SimpleGradientPanel();
        jLabel1 = new javax.swing.JLabel();
        referalclasscombo = new javax.swing.JComboBox();
        jXTitledPanel1 = new org.jdesktop.swingx.JXTitledPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        refbydept = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        refbynotes = new javax.swing.JTextArea();
        refbyprovider = new javax.swing.JTextField();
        searchrefbybutton = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        jXTitledPanel2 = new org.jdesktop.swingx.JXTitledPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        reftodept = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        reftonotes = new javax.swing.JTextArea();
        reftoprovider = new javax.swing.JTextField();
        searchreftobutton = new javax.swing.JButton();
        savebutton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();

        referedbycombo.setEditable(true);

        referedtocombo.setEditable(true);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Referral Entry");

        jLabel1.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel1.setText("Referral Class :");

        referalclasscombo.setModel(new javax.swing.DefaultComboBoxModel(referralList));
        referalclasscombo.setSelectedIndex(-1);
        referalclasscombo.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                referalclasscomboItemStateChanged(evt);
            }
        });

        jXTitledPanel1.setTitle("Referred By :");
        jXTitledPanel1.setTitleFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N

        jLabel3.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel3.setText("Provider :");

        jLabel4.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel4.setText("Department :");

        jLabel5.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel5.setText("Notes :");

        refbynotes.setColumns(20);
        refbynotes.setRows(5);
        jScrollPane1.setViewportView(refbynotes);

        refbyprovider.setEditable(false);

        searchrefbybutton.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        searchrefbybutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search-icon16X16.png"))); // NOI18N
        searchrefbybutton.setOpaque(false);
        searchrefbybutton.setText("Search");
        searchrefbybutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchrefbybuttonActionPerformed(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(255, 0, 51));
        jLabel9.setText("*");

        javax.swing.GroupLayout jXTitledPanel1Layout = new javax.swing.GroupLayout(jXTitledPanel1.getContentContainer());
        jXTitledPanel1.getContentContainer().setLayout(jXTitledPanel1Layout);
        jXTitledPanel1Layout.setHorizontalGroup(
            jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXTitledPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addGap(1, 1, 1)
                .addGroup(jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXTitledPanel1Layout.createSequentialGroup()
                        .addComponent(refbydept, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
                        .addGap(510, 510, 510))
                    .addGroup(jXTitledPanel1Layout.createSequentialGroup()
                        .addGroup(jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jXTitledPanel1Layout.createSequentialGroup()
                                .addComponent(refbyprovider)
                                .addGap(9, 9, 9)
                                .addComponent(searchrefbybutton))
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(410, Short.MAX_VALUE))))
        );
        jXTitledPanel1Layout.setVerticalGroup(
            jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXTitledPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(refbyprovider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(searchrefbybutton)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(refbydept, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXTitledPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addGap(0, 49, Short.MAX_VALUE))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap())
        );

        jXTitledPanel2.setTitle("Referred To :");
        jXTitledPanel2.setTitleFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N

        jLabel6.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel6.setText("Provider :");

        jLabel7.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel7.setText("Department :");

        jLabel8.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel8.setText("Notes :");

        reftonotes.setColumns(20);
        reftonotes.setRows(5);
        jScrollPane2.setViewportView(reftonotes);

        reftoprovider.setEditable(false);

        searchreftobutton.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        searchreftobutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search-icon16X16.png"))); // NOI18N
        searchreftobutton.setOpaque(false);
        searchreftobutton.setText("Search");
        searchreftobutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                searchreftobuttonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jXTitledPanel2Layout = new javax.swing.GroupLayout(jXTitledPanel2.getContentContainer());
        jXTitledPanel2.getContentContainer().setLayout(jXTitledPanel2Layout);
        jXTitledPanel2Layout.setHorizontalGroup(
            jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXTitledPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane2)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXTitledPanel2Layout.createSequentialGroup()
                        .addGroup(jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(reftodept, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(reftoprovider, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(searchreftobutton)))
                .addContainerGap(413, Short.MAX_VALUE))
        );
        jXTitledPanel2Layout.setVerticalGroup(
            jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXTitledPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(reftoprovider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(searchreftobutton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(reftodept, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXTitledPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXTitledPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(0, 50, Short.MAX_VALUE))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap())
        );

        savebutton.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        savebutton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Save-icon 16X16.png"))); // NOI18N
        savebutton.setOpaque(false);
        savebutton.setText("Save");
        savebutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                savebuttonActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 0, 51));
        jLabel2.setText("*");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jXTitledPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jXTitledPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(savebutton))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(1, 1, 1)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(referalclasscombo, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(referalclasscombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jXTitledPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jXTitledPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(savebutton)
                .addContainerGap())
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void referalclasscomboItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_referalclasscomboItemStateChanged
        /*String name = referalclasscombo.getSelectedItem().toString();
        if(name.equalsIgnoreCase("incoming")){
            new AutoSuggestorDoctor().suggesting(referedbycombo, referraldoctorList);
            new AutoSuggestorDoctor().suggesting(referedtocombo, withoutreferaldoclist);
        }else if(name.equalsIgnoreCase("outgoing")){
            new AutoSuggestorDoctor().suggesting(referedbycombo, withoutreferaldoclist);
            new AutoSuggestorDoctor().suggesting(referedtocombo, referraldoctorList);
        }else if(name.equalsIgnoreCase("internal")){
            new AutoSuggestorDoctor().suggesting(referedbycombo, withoutreferaldoclist);
            new AutoSuggestorDoctor().suggesting(referedtocombo, withoutreferaldoclist);
        }else{
            new AutoSuggestorDoctor().suggesting(referedbycombo, doctorList);
            new AutoSuggestorDoctor().suggesting(referedtocombo, doctorList);
        }*/
    }//GEN-LAST:event_referalclasscomboItemStateChanged

    private void searchrefbybuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchrefbybuttonActionPerformed
        buttonclick = "refby";
        searchfordoc(buttonclick);
    }//GEN-LAST:event_searchrefbybuttonActionPerformed

    private void searchreftobuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchreftobuttonActionPerformed
        buttonclick = "refto";
        searchfordoc(buttonclick);
    }//GEN-LAST:event_searchreftobuttonActionPerformed

    private void savebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_savebuttonActionPerformed
        if(validatereferal()){
            //referalinfo = new TReferral();
            TCCodeValues referalclass = (TCCodeValues)referalclasscombo.getSelectedItem();
            referalinfo.setReferalclass(referalclass);
            referalinfo.setRefbyprovider(refbydoc);
            referalinfo.setRefbydept(refbydept.getText().length()>0?refbydept.getText():null);
            referalinfo.setRefbynotes(refbynotes.getText().length()>0?refbynotes.getText():null);

            referalinfo.setReftoprovider(reftodoc);
            referalinfo.setReftodept(reftodept.getText().length()>0?reftodept.getText():null);
            referalinfo.setReftonotes(reftonotes.getText().length()>0?reftonotes.getText():null);
            this.dispose();
        }
    }//GEN-LAST:event_savebuttonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                /*if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }*/UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ReferralDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ReferralDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ReferralDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ReferralDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                ReferralDialog dialog = new ReferralDialog(new javax.swing.JFrame(), true, new TReferral());
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private org.jdesktop.swingx.JXTitledPanel jXTitledPanel1;
    private org.jdesktop.swingx.JXTitledPanel jXTitledPanel2;
    private javax.swing.JTextField refbydept;
    private javax.swing.JTextArea refbynotes;
    private javax.swing.JTextField refbyprovider;
    private javax.swing.JComboBox referalclasscombo;
    private javax.swing.JComboBox referedbycombo;
    private javax.swing.JComboBox referedtocombo;
    private javax.swing.JTextField reftodept;
    private javax.swing.JTextArea reftonotes;
    private javax.swing.JTextField reftoprovider;
    private javax.swing.JButton savebutton;
    private javax.swing.JButton searchrefbybutton;
    private javax.swing.JButton searchreftobutton;
    // End of variables declaration//GEN-END:variables
    private ReferralController referralController;
    //public static ApplicationContext context ;
    private Vector<TCCodeValues> referralList = new Vector<TCCodeValues>();
    private Vector<TDoctorInformation> doctorList = new Vector<TDoctorInformation>();
    private Vector<TDoctorInformation> referraldoctorList = new Vector<TDoctorInformation>();
    private Vector<TDoctorInformation> withoutreferaldoclist = new Vector<TDoctorInformation>();
    private JRootPane rootPane;
    private DisabledGlassPane glassPane;
    private JFrame MainAPP;
    private String buttonclick;
    private String buttonclick2;
    private TReferral referalinfo;
    private TDoctorInformation refbydoc;
    private TDoctorInformation reftodoc;
    
    /*static{
        context =ContextLoading.context;
    }*/
    private void populate() {
        referralController = (ReferralController)ContextLoading.context.getBean("referralController");
        referalinfo = new TReferral();
        try{
            referralList = referralController.getCodeValues("referral");
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    
    protected JRootPane createRootPane() {
        JRootPane rootPane = new JRootPane();
        KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE");
        Action actionListener = new AbstractAction() {
          public void actionPerformed(ActionEvent actionEvent) {
            dispose();
          }
        };
        InputMap inputMap = rootPane
            .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
        inputMap.put(stroke, "ESCAPE");
        rootPane.getActionMap().put("ESCAPE", actionListener);

        return rootPane;
    }

    private void searchfordoc(String buttonclick) {
        rootPane = SwingUtilities.getRootPane(this);
        glassPane = new DisabledGlassPane();
        buttonclick2 = buttonclick;
            try {
                SwingWorker s = new SwingWorker() {
                    
                    @Override
                    protected Object doInBackground() throws Exception {
                        rootPane.setGlassPane(glassPane);
                        glassPane.activateLoadingImage();
                        doctorList = referralController.getAllDoctors();
                        return doctorList;
                    }

                    @Override
                    protected void done() {
                        if(doctorList.size()!=0){
                            super.done();
                            glassPane.deactivate();
                            glassPane.activate("");
                            DocSearchDialog docSearchDialog = new DocSearchDialog(MainAPP, true,doctorList);
                            docSearchDialog.setResizable(false);
                            docSearchDialog.setLocationRelativeTo(null);
                            docSearchDialog.setVisible(true);
                            docSearchDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
                            glassPane.deactivate();
                            TDoctorInformation doc = docSearchDialog.getDoctor();
                            if(doc!=null){
                                if(buttonclick2.equalsIgnoreCase("refby")){
                                    refbyprovider.setText(doc.getDoctor_name());
                                    refbydoc = doc;
                                }else if(buttonclick2.equalsIgnoreCase("refto")){
                                    reftoprovider.setText(doc.getDoctor_name());
                                    reftodoc = doc;
                                }
                            }
                        }else{
                            JOptionPane.showMessageDialog(null, "No doctors present");
                            glassPane.deactivate();
                        }
                    }
                };
                s.execute();
            } catch (Exception ex) {
                Logger.getLogger(ReferralDialog.class.getName()).log(Level.SEVERE, null, ex);
            }
     }
    
    public TReferral getReferalInfo(){
        return referalinfo;
    }

    private void showreferalinfo(TReferral referal) {
        if(referal.getRefbyprovider()!=null){
            refbydoc = referal.getRefbyprovider();
            refbyprovider.setText(referal.getRefbyprovider().getDoctor_name());
        }else{
            refbyprovider.setText(null);
        }
        if(referal.getReftoprovider()!=null){
            reftodoc = referal.getReftoprovider();
            reftoprovider.setText(referal.getReftoprovider().getDoctor_name());
        }else{
            reftoprovider.setText(null);
        }       
        referalclasscombo.setSelectedIndex(getCodeValueIndex(referralList,referal.getReferalclass().getCodeValueName()));
        refbydept.setText(referal.getRefbydept());
        refbynotes.setText(referal.getRefbynotes());
        reftodept.setText(referal.getReftodept());
        reftonotes.setText(referal.getReftonotes());
    }
    
    public static int getCodeValueIndex(Vector<TCCodeValues> codeValueList,String codeValueName) {
        int index = -1;
        if (codeValueList != null && codeValueName != null) {
            for (int i = 0; i < codeValueList.size(); i++) {
                if (codeValueName.equalsIgnoreCase(codeValueList.get(i).getCodeValueName().toString())) {
                    index = i;
                    break;
                }
            }
        }
        return index;
    }

    private boolean validatereferal() {
        boolean valid = true;
        if(referalclasscombo.getSelectedIndex()==-1){
            JOptionPane.showMessageDialog(null, "Select referral class");
            valid = false;
        }else if(refbyprovider.getText().length()<=0){
            JOptionPane.showMessageDialog(null, "Enter refer by provider");
            valid = false;
        }/*else if(reftoprovider.getText().length()<=0){
            JOptionPane.showMessageDialog(null, "Enter refer to provider");
            valid = false;
        }*/
        return valid;
    }
}

Commits for KNH_Project/HealthCareCommonUtil/src/main/java/com/bestray/healthcarecommonutil/views/ReferralDialog.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 13:29:42 +0000