Subversion Repository Public Repository

Satyam

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

import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.Initcap;
import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.util.TextAreaRenderer;
import com.bestray.healthcarecommonutil.vo.TEncounterProcedure;
import com.bestray.healthcarecommonutil.vo.TPatEncOrderResults;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcareemr.Controller.OutPatientController;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.KeyEvent;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;

/**
 *
 * @author user3
 */
public class LabReportsPanel extends javax.swing.JPanel {

    /**
     * Creates new form LabReportsPanel
     */
    public LabReportsPanel(TPatient patientinfo) {
        this.patientinfo = patientinfo;
        populate();
        initComponents();
        updateLabInfo();
        
    }

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

        jSplitPane1 = new javax.swing.JSplitPane();
        jPanel1 = new SimpleGradientPanel();
        jScrollPane11 = new javax.swing.JScrollPane();
        enclab_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;
            }
        };
        displaypanel = new javax.swing.JPanel();
        defaultpanel = new SimpleGradientPanel(Color.LIGHT_GRAY,Color.WHITE);
        jLabel35 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jScrollPane27 = new javax.swing.JScrollPane();
        labreportPanel = new SimpleGradientPanel(Color.LIGHT_GRAY,Color.WHITE);
        jPanel21 = new javax.swing.JPanel();
        jLabel64 = new javax.swing.JLabel();
        ordernamelabel = new javax.swing.JLabel();
        jLabel67 = new javax.swing.JLabel();
        orderdatelabel = new javax.swing.JLabel();
        orderbylabel = new javax.swing.JLabel();
        jLabel70 = new javax.swing.JLabel();
        jScrollPane28 = new javax.swing.JScrollPane();
        labresulttable = 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(240, 240, 240));
                }
                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;
            }
        };

        setLayout(new java.awt.BorderLayout());

        jSplitPane1.setBorder(null);
        jSplitPane1.setDividerLocation(420);
        jSplitPane1.setDividerSize(-1);

        jScrollPane11.setBorder(null);

        enclab_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "Lab Reports"
            }
        ));
        enclab_table.setRowHeight(22);
        enclab_table.getTableHeader().setReorderingAllowed(false);
        enclab_table.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                enclab_tableMouseClicked(evt);
            }
        });
        enclab_table.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                enclab_tableKeyPressed(evt);
            }
        });
        jScrollPane11.setViewportView(enclab_table);

        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()
                .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE)
                .addContainerGap())
        );

        jSplitPane1.setLeftComponent(jPanel1);

        displaypanel.setLayout(new java.awt.CardLayout());

        jLabel35.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/click.png"))); // NOI18N

        jLabel33.setFont(new java.awt.Font("Bookman Old Style", 0, 16)); // NOI18N
        jLabel33.setText("Select a record to show details....");

        javax.swing.GroupLayout defaultpanelLayout = new javax.swing.GroupLayout(defaultpanel);
        defaultpanel.setLayout(defaultpanelLayout);
        defaultpanelLayout.setHorizontalGroup(
            defaultpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(defaultpanelLayout.createSequentialGroup()
                .addContainerGap(18, Short.MAX_VALUE)
                .addComponent(jLabel35)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel33)
                .addContainerGap(30, Short.MAX_VALUE))
        );
        defaultpanelLayout.setVerticalGroup(
            defaultpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(defaultpanelLayout.createSequentialGroup()
                .addContainerGap(159, Short.MAX_VALUE)
                .addGroup(defaultpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel35, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel33, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(230, Short.MAX_VALUE))
        );

        displaypanel.add(defaultpanel, "card1");

        jScrollPane27.setBorder(null);

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

        jLabel64.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        jLabel64.setText("Order Name :");

        ordernamelabel.setFont(new java.awt.Font("SansSerif", 0, 13)); // NOI18N
        ordernamelabel.setText("ordernamelabel");

        jLabel67.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        jLabel67.setText("Order Date :");

        orderdatelabel.setFont(new java.awt.Font("SansSerif", 0, 13)); // NOI18N
        orderdatelabel.setText("orderdatelabel");

        orderbylabel.setFont(new java.awt.Font("SansSerif", 0, 13)); // NOI18N
        orderbylabel.setText("orderbylabel");

        jLabel70.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        jLabel70.setText("Order By :");

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel64)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ordernamelabel)
                .addGap(18, 18, 18)
                .addComponent(jLabel67)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(orderdatelabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 216, Short.MAX_VALUE)
                .addComponent(jLabel70)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(orderbylabel)
                .addContainerGap())
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel64)
                    .addComponent(ordernamelabel)
                    .addComponent(jLabel67)
                    .addComponent(orderdatelabel)
                    .addComponent(orderbylabel)
                    .addComponent(jLabel70))
                .addContainerGap())
        );

        labresulttable.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        labresulttable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Components", "Result", "Unit", "Comments"
            }
        ));
        labresulttable.setRowHeight(23);
        jScrollPane28.setViewportView(labresulttable);

        javax.swing.GroupLayout labreportPanelLayout = new javax.swing.GroupLayout(labreportPanel);
        labreportPanel.setLayout(labreportPanelLayout);
        labreportPanelLayout.setHorizontalGroup(
            labreportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(labreportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(labreportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane28))
                .addContainerGap())
        );
        labreportPanelLayout.setVerticalGroup(
            labreportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(labreportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane28, javax.swing.GroupLayout.DEFAULT_SIZE, 378, Short.MAX_VALUE)
                .addContainerGap())
        );

        jScrollPane27.setViewportView(labreportPanel);

        displaypanel.add(jScrollPane27, "card3");

        jSplitPane1.setRightComponent(displaypanel);

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

    private void enclab_tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_enclab_tableMouseClicked
        enclab_tableClick();
    }//GEN-LAST:event_enclab_tableMouseClicked

    private void enclab_tableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_enclab_tableKeyPressed
        event = evt;
        EventQueue.invokeLater(new Runnable() {
            int code = event.getKeyCode();
            public void run() {
                if(code==KeyEvent.VK_DOWN||code==KeyEvent.VK_UP){
                    enclab_tableClick();
                }
            }
        });
    }//GEN-LAST:event_enclab_tableKeyPressed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel defaultpanel;
    public static javax.swing.JPanel displaypanel;
    private javax.swing.JTable enclab_table;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel64;
    private javax.swing.JLabel jLabel67;
    private javax.swing.JLabel jLabel70;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane27;
    private javax.swing.JScrollPane jScrollPane28;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JPanel labreportPanel;
    private javax.swing.JTable labresulttable;
    private javax.swing.JLabel orderbylabel;
    private javax.swing.JLabel orderdatelabel;
    private javax.swing.JLabel ordernamelabel;
    // End of variables declaration//GEN-END:variables
    private OutPatientController outPatientController;
    private DefaultTableModel model;
    private Vector<Object> addObject;
    private KeyEvent event;
    private SimpleDateFormat sdftime = new SimpleDateFormat("dd-MM-YYYY  hh:mm:ss a");
    private TPatient patientinfo;
    
    private void populate(){
        outPatientController=(OutPatientController)HealthcareLogin.context.getBean("outPatientController");
    }
    
    private void enclab_tableClick() {
        try{
            int row = enclab_table.getSelectedRow();
            Object o1= enclab_table.getValueAt(row, 1);
            Object o2 = enclab_table.getValueAt(row, 3);
            Object o3 = enclab_table.getValueAt(row, 4);
            Object o4 = enclab_table.getValueAt(row, 0);
            ordernamelabel.setText(String.valueOf(o1));
            orderdatelabel.setText(String.valueOf(o2));
            orderbylabel.setText(String.valueOf(o3));
            displayLabRowValues(Long.parseLong(o4.toString()));
            CardLayout card2 = (CardLayout) displaypanel.getLayout();
            card2.show(displaypanel, "card3");
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    
    private void displayLabRowValues(Long o4) {
        Long encProcedureId = o4;
        try {
            TEncounterProcedure encproc = outPatientController.getProcedureEncounterByID(encProcedureId); 
            List<TPatEncOrderResults> labresults = outPatientController.getLabResultsByProcedureId(encproc);
            labresulttable.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {"Component","Result","Unit","Comments"}));
            labresulttable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
            model = (DefaultTableModel)labresulttable.getModel();
            TableColumnModel cmodel = labresulttable.getColumnModel(); 
            TextAreaRenderer textAreaRenderer = new TextAreaRenderer();
            cmodel.getColumn(1).setCellRenderer(textAreaRenderer); 
            cmodel.getColumn(3).setCellRenderer(textAreaRenderer); 
            for(TPatEncOrderResults labres:labresults){
                addObject = new Vector<Object>(); 
                addObject.add(Initcap.toInitCap(labres.getComponentId().getComponentName().toLowerCase()));
                addObject.add(labres.getComponentResults());
                addObject.add(labres.getComponentId().getUnit());
                addObject.add(labres.getComponentNotes());
                model.addRow(addObject);
            }
        } catch (ProcessingException ex) {
            Logger.getLogger(OutPatientDialog.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public void updateLabInfo(){
        List<TEncounterProcedure> labList = null;
        List<TEncounterProcedure> labList2 = new ArrayList<TEncounterProcedure>();
        List<TPatientEncounter> encounterList = null;
        try {
            encounterList = outPatientController.getEncounterDates(patientinfo);
            for(TPatientEncounter p:encounterList){
                labList = outPatientController.getEncounterLabsProcedure(p);
                for(TEncounterProcedure lab:labList){
                    labList2.add(lab);
                }
            }
        }catch (ProcessingException ex) {
            Logger.getLogger(OutPatientEncounterPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
        enclab_table.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {"Id","Lab Reports","Status","Order Date", "Order By"}));
        enclab_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        enclab_table.getColumnModel().getColumn(0).setMinWidth(0);
        enclab_table.getColumnModel().getColumn(0).setPreferredWidth(0);
        enclab_table.getColumnModel().getColumn(0).setMaxWidth(0);
        enclab_table.getColumnModel().getColumn(1).setMinWidth(10);
        enclab_table.getColumnModel().getColumn(1).setPreferredWidth(100);
        enclab_table.getColumnModel().getColumn(1).setMaxWidth(150);
        enclab_table.getColumnModel().getColumn(2).setMinWidth(10);
        enclab_table.getColumnModel().getColumn(2).setPreferredWidth(60);
        enclab_table.getColumnModel().getColumn(2).setMaxWidth(80);
        enclab_table.getColumnModel().getColumn(3).setMinWidth(10);
        enclab_table.getColumnModel().getColumn(3).setPreferredWidth(140);
        enclab_table.getColumnModel().getColumn(3).setMaxWidth(150);
        model = (DefaultTableModel)enclab_table.getModel();
        for(TEncounterProcedure lab:labList2){
            addObject = new Vector<Object>();
            addObject.add(lab.getId());
            addObject.add(lab.getProcedure().getProcedureName());
            addObject.add(Initcap.toInitCap(lab.getOrderStatus().toLowerCase()));
            addObject.add(sdftime.format(lab.getOrderDate()));
            addObject.add(Initcap.toInitCap(lab.getOrderBy().toLowerCase()));
            model.addRow(addObject);
        }
    }
}

Commits for Satyam/AuroCareEMR/src/main/java/com/bestray/healthcareemr/Views/LabReportsPanel.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 20 Jul, 2018 05:59:17 +0000