Subversion Repository Public Repository

Pharmacy_09_03_18

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

import com.bestray.healthcarecommonutil.controller.MyFavController;
import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.DisabledGlassPane;
import com.bestray.healthcarecommonutil.util.HeadingPanel;
import com.bestray.healthcarecommonutil.util.PanelType;
import com.bestray.healthcarecommonutil.util.PreferenceUtil;
import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.util.TextPrompt;
import com.bestray.healthcarecommonutil.util.Theme;
import com.bestray.healthcarecommonutil.views.MyFavDiagnosisSearchDialog;
import com.bestray.healthcarecommonutil.vo.TAccount;
import com.bestray.healthcarecommonutil.vo.TDiagnosisMaster;
import com.bestray.healthcarecommonutil.vo.TEncounterDiagnosis;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcareemr.Controller.AmbulatoryDiagnosisController;
import com.bestray.healthcareemr.Controller.DiagnosisMasterController;
import com.bestray.healthcareemr.Controller.OutPatientController;
import com.bestray.healthcareemr.Util.MessageProperties;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;

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

    /**
     * Creates new form AmbulatoryDiagosisPanel
     */
    public AmbulatoryDiagosisPanel() {
        initComponents();
        TextPrompt tp7 = new TextPrompt("Search For Diagnosis", search_textField);
        tp7.setForeground( Color.RED );
        tp7.changeAlpha(0.5f);
        tp7.changeStyle(Font.BOLD);
    }
    
    public AmbulatoryDiagosisPanel(TPatientEncounter encounter) {
        this.encounter = encounter;
        populateData();
        initComponents();
        TextPrompt tp7 = new TextPrompt("Search For Diagnosis", search_textField);
        tp7.setForeground( Color.RED );
        tp7.changeAlpha(0.5f);
        tp7.changeStyle(Font.BOLD);
        diagnosisTableModel();
        fetchAvailableDiagnosis();
    }

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

        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        diagnosis_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;
            }

        };
        jToolBar2 = new javax.swing.JToolBar();
        jButton1 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jPanel2 = new HeadingPanel("", Theme.GLOSSY_SKYBLUE_THEME, PanelType.PANEL_ROUNDED_RECTANGLUR);
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jPanel3 = new SimpleGradientPanel();
        search_textField = new javax.swing.JTextField();
        jToolBar1 = new javax.swing.JToolBar();
        search_button = new javax.swing.JButton();

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

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

        diagnosis_table.setAutoCreateRowSorter(true);
        diagnosis_table.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        diagnosis_table.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"
            }
        ));
        diagnosis_table.setRowHeight(25);
        diagnosis_table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        diagnosis_table.setShowHorizontalLines(false);
        diagnosis_table.setShowVerticalLines(false);
        diagnosis_table.getTableHeader().setReorderingAllowed(false);
        diagnosis_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 10));
        jScrollPane1.setViewportView(diagnosis_table);

        jToolBar2.setBackground(new java.awt.Color(204, 204, 255));
        jToolBar2.setFloatable(false);
        jToolBar2.setRollover(true);

        jButton1.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/delete 16x16.png"))); // NOI18N
        jButton1.setText("Remove");
        jButton1.setFocusable(false);
        jButton1.setMargin(new java.awt.Insets(2, 20, 2, 20));
        jButton1.setOpaque(false);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar2.add(jButton1);

        jButton5.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jButton5.setText("Edit Details");
        jButton5.setFocusable(false);
        jButton5.setMargin(new java.awt.Insets(2, 20, 2, 20));
        jButton5.setOpaque(false);
        jButton5.setVisible(false);
        jToolBar2.add(jButton5);

        jButton4.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jButton4.setText("Previeous Diagnosis");
        jButton4.setFocusable(false);
        jButton4.setMargin(new java.awt.Insets(2, 20, 2, 20));
        jButton4.setOpaque(false);
        jButton4.setVisible(false);
        jToolBar2.add(jButton4);

        jPanel2.setBackground(new java.awt.Color(127, 180, 234));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Text-Edit-icon24X24.png"))); // NOI18N

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Diagnosis Details");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(jLabel1)
                .addGap(5, 5, 5))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addContainerGap())
        );

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

        search_textField.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        search_textField.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                search_textFieldKeyPressed(evt);
            }
        });

        jToolBar1.setBackground(new java.awt.Color(255, 255, 255));
        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);
        jToolBar1.setOpaque(false);

        search_button.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        search_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search-icon16X16.png"))); // NOI18N
        search_button.setText("Search");
        search_button.setFocusable(false);
        search_button.setMargin(new java.awt.Insets(2, 20, 2, 20));
        search_button.setOpaque(false);
        search_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                search_buttonActionPerformed(evt);
            }
        });
        jToolBar1.add(search_button);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(search_textField, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGap(8, 8, 8)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(search_textField)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(8, 8, 8))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 1026, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0))
        );

        add(jPanel1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void search_textFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_search_textFieldKeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            search_button.doClick();
        }
    }//GEN-LAST:event_search_textFieldKeyPressed

    private void search_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_search_buttonActionPerformed
        rootPane = SwingUtilities.getRootPane(this);
        glassPane = new DisabledGlassPane();
        if(search_textField.getText().length()>=0){
            try {
                expr = search_textField.getText();
                SwingWorker s = new SwingWorker() {

                    @Override
                    protected Object doInBackground() throws Exception {
                        rootPane.setGlassPane(glassPane);
                        glassPane.activateLoadingImage();
                        if(expr.length()>0){
                            diaglist = outPatientController.getDiagnosis(expr);
                        }else{
                            diaglist = diagnosisController.getAllDiagnosis();
                        }
                        return diaglist;
                    }

                    @Override
                    protected void done() {
                        if(diaglist.size()!=0){
                            super.done();
                            myfavdiaglist = new Vector<TDiagnosisMaster>();
                            try {
                                myfavdiaglist = myFavController.getFavDiagByAccount(useraccount,"DIAGNOSIS");
                            } catch (ProcessingException ex) {
                                Logger.getLogger(EncounterFollowupPanel.class.getName()).log(Level.SEVERE, null, ex);
                            }
                            glassPane.deactivate();
                            glassPane.activate("");
                            MyFavDiagnosisSearchDialog diagnosisSearchDialog = new MyFavDiagnosisSearchDialog(MainAPP, true,diaglist,myfavdiaglist,expr);
                            diagnosisSearchDialog.setResizable(false);
                            diagnosisSearchDialog.setLocationRelativeTo(null);
                            diagnosisSearchDialog.setVisible(true);
                            diagnosisSearchDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
                            glassPane.deactivate();
                            List<TDiagnosisMaster> diag = diagnosisSearchDialog.getDiagnosisList();
                            if(diag!=null){
                                if(isDuplicateDiagnosis(diag)){
                                    int reply = JOptionPane.showConfirmDialog(null, "Do you want to add ?", " Message", JOptionPane.YES_NO_OPTION);
                                    if(reply == JOptionPane.YES_OPTION){
                                        showSelectedDiagnosis(diag);
                                    }else{
                                     //do some thing 
                                    }
                                }else{
                                  showSelectedDiagnosis(diag);
                                }
                            }
                        }else{
                            JOptionPane.showMessageDialog(null, "No diagnosis present");
                            glassPane.deactivate();
                            search_textField.setText(null);
                        }
                    }
                };
                s.execute();
            } catch (Exception ex) {
                Logger.getLogger(OutPatientEncounterPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else{
            JOptionPane.showMessageDialog(null, "Search filed is empty");
        }
    }//GEN-LAST:event_search_buttonActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        int row = diagnosis_table.getSelectedRow();
        model = (DefaultTableModel) diagnosis_table.getModel();
            if(row!=-1){
                    TEncounterDiagnosis diagnosis = (TEncounterDiagnosis)diagnosis_table.getValueAt(row, 0);
                    model.removeRow(row);
                    removeDiagnosis(diagnosis.getId());               
            }else{
                JOptionPane.showMessageDialog(null, "No diagnosis selected for delete");
            }
    }//GEN-LAST:event_jButton1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable diagnosis_table;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JButton search_button;
    private javax.swing.JTextField search_textField;
    // End of variables declaration//GEN-END:variables
    private TPatientEncounter encounter = new TPatientEncounter();
    private TEncounterDiagnosis diagnosisEnc = new TEncounterDiagnosis();
    private MyFavController myFavController;
    private AmbulatoryDiagnosisController ambulatoryDiagnosisController;
    private DiagnosisMasterController diagnosisController;
    private OutPatientController outPatientController;
    private javax.swing.JFrame MainAPP;
    private JRootPane rootPane;
    private DisabledGlassPane glassPane;
    private TAccount useraccount;
    private Preferences myPrefObj = Preferences.userRoot();
    private String expr;
    private Vector<TDiagnosisMaster> diaglist = new Vector<TDiagnosisMaster>();
    private Vector<TDiagnosisMaster> myfavdiaglist = new Vector<TDiagnosisMaster>();
    private List<TEncounterDiagnosis> availableDiagnosisOnCurrentEnc = new ArrayList<TEncounterDiagnosis>();
    private Vector<Object> addObject;
    private DefaultTableModel model;

    private void populateData() {
        outPatientController=(OutPatientController)HealthcareLogin.context.getBean("outPatientController");
        ambulatoryDiagnosisController = (AmbulatoryDiagnosisController)HealthcareLogin.context.getBean("ambulatoryDiagnosisController");
        diagnosisController = (DiagnosisMasterController)HealthcareLogin.context.getBean("diagnosisMasterController");
        myFavController = (MyFavController)HealthcareLogin.context.getBean("myFavController");
        try{
            useraccount = (TAccount)PreferenceUtil.getObject(myPrefObj, "user");
        }catch(Exception e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Current ueser details"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }
    }

    private void diagnosisTableModel() {
        diagnosis_table.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {
                "Obj", "diagnosisObj", "Diagnosis Name","ICD-10 Code","Comments"}));
        diagnosis_table.getColumnModel().getColumn(0).setMinWidth(0);
        diagnosis_table.getColumnModel().getColumn(0).setPreferredWidth(0);
        diagnosis_table.getColumnModel().getColumn(0).setMaxWidth(0);
        diagnosis_table.getColumnModel().getColumn(1).setMinWidth(0);
        diagnosis_table.getColumnModel().getColumn(1).setPreferredWidth(0);
        diagnosis_table.getColumnModel().getColumn(1).setMaxWidth(0);
    }

    private void fetchAvailableDiagnosis() {
        try{
            availableDiagnosisOnCurrentEnc = ambulatoryDiagnosisController.getEncounterDiagnosis(encounter);
        } catch (ProcessingException ex) {
            Logger.getLogger(AmbulatoryDiagosisPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
        showAvaialbleDiagnosis(availableDiagnosisOnCurrentEnc);
    }
    
    private void showAvaialbleDiagnosis(List<TEncounterDiagnosis> diagnosis) {
        model = (DefaultTableModel)diagnosis_table.getModel();
          for(TEncounterDiagnosis encDiagnosis:diagnosis){
            addObject = new Vector<Object>();  
            addObject.add(encDiagnosis);
            addObject.add(encDiagnosis.getDiagnosis());
            addObject.add(encDiagnosis.getDiagnosis().getDiagnosisName());
            addObject.add(encDiagnosis.getDiagnosis().getIcd10Codes());
            addObject.add(encDiagnosis.getComments());
            model.addRow(addObject);
          }             
    }
    /*show selected diagnosis By Encounter*/
    private void showSelectedDiagnosis(List<TDiagnosisMaster> selectedDiagnosis) {
        model = (DefaultTableModel)diagnosis_table.getModel();
       for(TDiagnosisMaster diagnosis : selectedDiagnosis){
           addObject = new Vector<Object>();  
           TEncounterDiagnosis encounterDiagnosis = new TEncounterDiagnosis();
           encounterDiagnosis.setEncounterDiagnosis(encounter);
           encounterDiagnosis.setDiagnosis(diagnosis);
           encounterDiagnosis.setComments("");
            try {
                diagnosisEnc = ambulatoryDiagnosisController.saveDiagnosisEncounter(encounterDiagnosis);
                addObject.add(diagnosisEnc);
                addObject.add(diagnosisEnc.getDiagnosis());
                addObject.add(diagnosisEnc.getDiagnosis().getDiagnosisName());
                addObject.add(diagnosisEnc.getDiagnosis().getIcd10Codes());
                addObject.add(diagnosisEnc.getComments());
                model.addRow(addObject);
            } catch (ProcessingException ex) {
                Logger.getLogger(AmbulatoryDiagosisPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
       }
    }
    
    private boolean isDuplicateDiagnosis(List<TDiagnosisMaster> diagnosisList){        
        boolean valid = false;
        if(diagnosis_table.getRowCount() > 0){
          for (int row = 0; row < diagnosis_table.getRowCount(); row++) {
            TDiagnosisMaster diag = (TDiagnosisMaster)diagnosis_table.getValueAt(row, 1);
            if(diagnosisList.contains(diag)){
                 valid = true;   
            }
          } 
        }
        return valid;
    }
    /*remove diagnosis from encounter*/
    private void removeDiagnosis(Long removeDiagnosisId){
            try {
                ambulatoryDiagnosisController.deleteEncounterDiagnosis(removeDiagnosisId);
            } catch (ProcessingException ex) {
                Logger.getLogger(AmbulatoryDiagosisPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalArgumentException ex) {
                Logger.getLogger(AmbulatoryDiagosisPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
}

Commits for Pharmacy_09_03_18/Dr Gyana ProjectSpace/DrGyanaEMR/src/main/java/com/bestray/healthcareemr/Views/AmbulatoryDiagosisPanel.java

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