Subversion Repository Public Repository

Aurocare_27_07_2018

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
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareemr.Views;

import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.ButtonType;
import com.bestray.healthcarecommonutil.util.CWTabbedPaneUI;
import com.bestray.healthcarecommonutil.util.CurvedGradientPanel;
import com.bestray.healthcarecommonutil.util.GlossyButton;
import com.bestray.healthcarecommonutil.util.Theme;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcareemr.Controller.PatientController;
import com.bestray.healthcareemr.Util.MessageProperties;
import com.bestray.healthcareemr.Util.UniqueID;
import com.bestray.healthcarecommonutil.vo.DuplicatePatient;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Vector;
import javax.swing.DefaultCellEditor;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author User1
 */
public class DuplicatePatientPanel extends javax.swing.JPanel {

    /**
     * Creates new form DuplicatePatientPanel
     */
    public DuplicatePatientPanel() {
        populate();
        initComponents();
        displayInfo();
    }

    /**
     * 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() {

        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        duplicatePatient_table1 = new javax.swing.JTable(){
            public boolean isCellEditable(int row, int column){
                return false;
            }
            public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
                if (rowIndex % 2 == 0 && !isCellSelected(rowIndex, vColIndex)) {
                    c.setForeground(Color.BLACK);
                    c.setBackground(new Color(200, 225, 250));
                }
                else if(rowIndex % 2 == 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else if(rowIndex % 2 != 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else {
                    c.setForeground(Color.BLACK);
                    c.setBackground(getBackground());
                }
                return c;
            }
        };
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        header_panel = new javax.swing.JPanel();
        patient_lookup_lable = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        name_search_panel = new CurvedGradientPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        duplicatePatient_table = new javax.swing.JTable(){
            public boolean isCellEditable(int row, int column){
                return false;
            }
            public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
                if (rowIndex % 2 == 0 && !isCellSelected(rowIndex, vColIndex)) {
                    c.setForeground(Color.BLACK);
                    c.setBackground(new Color(200, 225, 250));
                }
                else if(rowIndex % 2 == 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else if(rowIndex % 2 != 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else {
                    c.setForeground(Color.BLACK);
                    c.setBackground(getBackground());
                }
                return c;
            }

        };
        select_button = new GlossyButton("Reset",Theme.GLOSSY_GREEN_THEME,ButtonType.BUTTON_ROUNDED);
        totalPatientNo_label = new javax.swing.JLabel();
        totalPatientNo_tb = new javax.swing.JLabel();
        back_button = new GlossyButton("Reset",Theme.GLOSSY_GREEN_THEME,ButtonType.BUTTON_ROUNDED);
        merge_button = new GlossyButton("Reset",Theme.GLOSSY_GREEN_THEME,ButtonType.BUTTON_ROUNDED);
        jPanel1 = new javax.swing.JPanel();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(jTable1);

        duplicatePatient_table1.setModel(new javax.swing.table.DefaultTableModel(duplicatePatientList,header));
        duplicatePatient_table1.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        duplicatePatient_table1.setRowHeight(20);
        duplicatePatient_table1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane3.setViewportView(jTable2);

        setBackground(new java.awt.Color(255, 255, 255));

        header_panel.setBackground(new java.awt.Color(153, 204, 255));
        header_panel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        patient_lookup_lable.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        patient_lookup_lable.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search_patient-icon32X32.png"))); // NOI18N
        patient_lookup_lable.setText("Duplicate Patient Reconciliation");

        javax.swing.GroupLayout header_panelLayout = new javax.swing.GroupLayout(header_panel);
        header_panel.setLayout(header_panelLayout);
        header_panelLayout.setHorizontalGroup(
            header_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(header_panelLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addComponent(patient_lookup_lable)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        header_panelLayout.setVerticalGroup(
            header_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, header_panelLayout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(patient_lookup_lable)
                .addGap(0, 0, 0))
        );

        jTabbedPane1.setUI(new CWTabbedPaneUI());
        jTabbedPane1.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N

        name_search_panel.setBackground(new java.awt.Color(253, 251, 251));

        duplicatePatient_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Select", "Patient Id", "First Name", "Middle Name", "Last Name", "Gender", "Date Of Birth", "Joined Date", "Contact No", "Id"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        duplicatePatient_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        duplicatePatient_table.setRowHeight(20);
        duplicatePatient_table.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                duplicatePatient_tableMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(duplicatePatient_table);

        select_button.setBackground(java.awt.Color.white);
        select_button.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        select_button.setForeground(new java.awt.Color(68, 62, 173));
        select_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Done 24X24.png"))); // NOI18N
        select_button.setText("Select");
        select_button.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        select_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                select_buttonActionPerformed(evt);
            }
        });

        totalPatientNo_label.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        totalPatientNo_label.setText("Total No. Of Patients To Be Merged :");

        totalPatientNo_tb.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        totalPatientNo_tb.setText("jLabel2");

        back_button.setBackground(new java.awt.Color(255, 255, 255));
        back_button.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        back_button.setForeground(new java.awt.Color(68, 62, 173));
        back_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/forward.png"))); // NOI18N
        back_button.setText("Back");
        back_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_buttonActionPerformed(evt);
            }
        });
        back_button.setVisible(false);

        merge_button.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        merge_button.setForeground(new java.awt.Color(68, 62, 173));
        merge_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/merge icon 24X24.png"))); // NOI18N
        merge_button.setText("Merge");
        merge_button.setVisible(false);
        merge_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                merge_buttonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout name_search_panelLayout = new javax.swing.GroupLayout(name_search_panel);
        name_search_panel.setLayout(name_search_panelLayout);
        name_search_panelLayout.setHorizontalGroup(
            name_search_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(name_search_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(name_search_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(name_search_panelLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 728, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(name_search_panelLayout.createSequentialGroup()
                        .addComponent(totalPatientNo_label)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(totalPatientNo_tb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(back_button, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(merge_button, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(select_button, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(19, 19, 19))))
        );

        name_search_panelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {back_button, merge_button, select_button});

        name_search_panelLayout.setVerticalGroup(
            name_search_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(name_search_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(name_search_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(name_search_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(select_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(back_button)
                        .addComponent(merge_button))
                    .addGroup(name_search_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(totalPatientNo_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(totalPatientNo_tb)))
                .addContainerGap())
        );

        name_search_panelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {back_button, merge_button, select_button});

        jTabbedPane1.addTab("Merge", name_search_panel);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 748, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 388, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("Unmerge", jPanel1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(header_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jTabbedPane1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(header_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void select_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_select_buttonActionPerformed
        int row = duplicatePatient_table.getSelectedRow();
        if(row>=0){
            DuplicatePatient patient= new DuplicatePatient();
            patient.setFname(String.valueOf(duplicatePatient_table.getValueAt(row, 0)));
            patient.setMname(String.valueOf(duplicatePatient_table.getValueAt(row, 1)));
            patient.setLname(String.valueOf(duplicatePatient_table.getValueAt(row, 2)));
            patient.setGender(String.valueOf(duplicatePatient_table.getValueAt(row, 3)));
            try{
                duplicateRecordPatientList = patientController.findDuplicateRecordsByPatient(patient);
            }catch(Exception e){
                JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"duplicate records of patient"}));
                throw new HealthCareException(MessageProperties.getMessage("error.dao"));
            }
            headerString=new String[]{"Select","Patient Id", "First Name", "Middle Name", "Last Name", "Gender", "Date Of Birth","Joined Date", "Contact No","Id"};
            
            duplicatePatient_table.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},headerString) {
                Class[] types = new Class [] {java.lang.Boolean.class,java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class,java.lang.String.class,java.lang.Long.class};
                public Class getColumnClass(int columnIndex) {
                    return types [columnIndex];
                }
          });
          duplicatePatient_table.getColumn("Select").setCellEditor(new DefaultCellEditor(new JCheckBox()));
          duplicatePatient_table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
          duplicatePatient_table.getColumnModel().getColumn(0).setPreferredWidth(60);
          duplicatePatient_table.getColumnModel().getColumn(0).setMinWidth(60);
          duplicatePatient_table.getColumnModel().getColumn(0).setMaxWidth(60);
          
          duplicatePatient_table.getColumnModel().getColumn(9).setPreferredWidth(0);
          duplicatePatient_table.getColumnModel().getColumn(9).setMinWidth(0);
          duplicatePatient_table.getColumnModel().getColumn(9).setMaxWidth(0);
          DefaultTableModel model = (DefaultTableModel)duplicatePatient_table.getModel();
          for(TPatient pat:duplicateRecordPatientList){
             addObject = new Vector<Object>();
             addObject.add( new Boolean(false));
             addObject.add(pat.getPatientId());
             addObject.add(pat.getPatientFName());
             if(pat.getPatientMName()!=null){
                 addObject.add(pat.getPatientMName());
             }else{
                 addObject.add("");
             }
             addObject.add(pat.getPatientLName());
             addObject.add(pat.getPatientGender());
             if(pat.getBirthDate()!=null){
                 addObject.add(sdf.format(pat.getBirthDate()));
             }else{
                 addObject.add("");
             }
             if(pat.getJoinedDate()!=null){
                 addObject.add(sdf.format(pat.getJoinedDate()));  
             }else{
                 addObject.add("");
             }
             if(pat.getPatientMNumber()!=null){
                addObject.add(String.valueOf(pat.getPatientMNumber()));
             }else{
                 addObject.add("-");
             }
             addObject.add(pat.getId());
             model.addRow(addObject);
             
        }
    
            totalPatientNo_tb.setText(String.valueOf(duplicateRecordPatientList.size()));
            select_button.setVisible(false);
            back_button.setVisible(true);
            merge_button.setVisible(true);
        }else{
            JOptionPane.showMessageDialog(null,MessageProperties.getMessage("notselected"));
        }
        
    }//GEN-LAST:event_select_buttonActionPerformed

    private void back_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_buttonActionPerformed
        backButtonMethod();
    }//GEN-LAST:event_back_buttonActionPerformed

    private void merge_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_merge_buttonActionPerformed
        patient = new TPatient();
        String ids = "";
        String patientIds = "";
        for(int row=0;row<duplicatePatient_table.getRowCount();row++){
            if(duplicatePatient_table.getValueAt(row, 0).equals(true)){
                patientIds = patientIds.concat(String.valueOf(duplicatePatient_table.getValueAt(row, 1))).concat(",");
                ids = ids.concat(String.valueOf(duplicatePatient_table.getValueAt(row, 9))).concat(",");
                try{
                    patient.setPatientId(patientController.getPatientId());
                }catch(Exception e){
                    throw new HealthCareException("Failed To Get The Max Patient Id");
                }
                patient.setPatientFName(duplicatePatient_table.getValueAt(row, 2).toString());
                patient.setPatientMName(duplicatePatient_table.getValueAt(row, 3).toString());
                patient.setPatientLName(duplicatePatient_table.getValueAt(row, 4).toString());
                patient.setPatientGender(duplicatePatient_table.getValueAt(row, 5).toString());
                patient.setPatientStatus("ACTIVE");
                
            }
        }
        int lastindex = patientIds.lastIndexOf(",");
        String finalpatientids = patientIds.substring(0, lastindex);
        lastindex = ids.lastIndexOf(",");
        String finalids = ids.substring(0, lastindex);
        
        try{
            patientController.mergePatients(finalpatientids,patient,finalids);
            JOptionPane.showMessageDialog(null,MessageProperties.getMessage("success.merge"));
            backButtonMethod();
        }catch(Exception e){
            JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.merge"));
        }
    }//GEN-LAST:event_merge_buttonActionPerformed

    private void duplicatePatient_tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_duplicatePatient_tableMouseClicked
        if(evt.getClickCount()==1){
            if(duplicateRecordPatientList!=null){
                int row = duplicatePatient_table.getSelectedRow();
                if(duplicatePatient_table.getValueAt(row, 0).equals(false)){
                    duplicatePatient_table.setValueAt(true, row, 0);
                }else{
                    duplicatePatient_table.setValueAt(false, row, 0);
                }
            }
        }
    }//GEN-LAST:event_duplicatePatient_tableMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton back_button;
    private javax.swing.JTable duplicatePatient_table;
    private javax.swing.JTable duplicatePatient_table1;
    private javax.swing.JPanel header_panel;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JButton merge_button;
    private javax.swing.JPanel name_search_panel;
    private javax.swing.JLabel patient_lookup_lable;
    private javax.swing.JButton select_button;
    private javax.swing.JLabel totalPatientNo_label;
    private javax.swing.JLabel totalPatientNo_tb;
    // End of variables declaration//GEN-END:variables
    private Vector<Vector<String>> duplicatePatientList;
    private List<TPatient> duplicateRecordPatientList;
    private PatientController patientController;
    private DefaultTableModel model; 
    private Vector<String> header;
    private Vector<String> selectedHeader;
    private Vector<Object> addObject;
    private SimpleDateFormat sdf;
    private String[] headerString;
    private Object[][] data = {};
    private TPatient patient;
    private void populate(){
        sdf = new SimpleDateFormat("dd-MM-yyyy");
        patientController = (PatientController)HealthcareLogin.context.getBean("patientController");
        header = new Vector<String>();
        header.add("First Name");
        header.add("Middle Name");
        header.add("Last Name");
        header.add("Gender");
        header.add("No. Of Patients");
        
        
        /*selectedHeader = new Vector<String>();
        selectedHeader.add("Patient ID");
        selectedHeader.add("First Name");
        selectedHeader.add("Middle Name");
        selectedHeader.add("Last Name");
        selectedHeader.add("Gender");
        selectedHeader.add("Date Of Birth");*/
        try{
                duplicatePatientList = patientController.findDuplicatePatientDetails();
        }catch(ProcessingException e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"duplicate patient"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }
        
    }

    private void displayInfo() {
        duplicatePatient_table.setModel(new javax.swing.table.DefaultTableModel(duplicatePatientList,header));
        duplicatePatient_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        totalPatientNo_tb.setText(String.valueOf(duplicatePatientList.size()));
    }

    private void backButtonMethod() {
        duplicateRecordPatientList = null;
        try{
                duplicatePatientList = patientController.findDuplicatePatientDetails();
        }catch(ProcessingException e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"duplicate patient"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }
        duplicatePatient_table.setModel(new javax.swing.table.DefaultTableModel(duplicatePatientList,header));
        duplicatePatient_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        totalPatientNo_tb.setText(String.valueOf(duplicatePatientList.size()));
        back_button.setVisible(false);
        merge_button.setVisible(false);
        select_button.setVisible(true);
    }
        
}

Commits for Aurocare_27_07_2018/AuroCareEMR/src/main/java/com/bestray/healthcareemr/Views/DuplicatePatientPanel.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 07:21:55 +0000