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

import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.util.StandardButton;
import com.bestray.healthcarecommonutil.vo.TInpatentAdmission;
import com.bestray.healthcareinpatient.controller.AvailableInpatientController;
import com.bestray.healthcareinpatient.controller.InPatientAdmissionController;
import com.bestray.healthcareinpatient.util.MessageProperties;
import java.awt.BorderLayout;
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 javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;

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

    /**
     * Creates new form InPatient_Discharge_Panel
     */
    public InPatient_Discharge_Panel() {
        populate();
        initComponents();
        displayAdmittedPatientList();
    }

    /**
     * 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();
        jScrollPane1 = new javax.swing.JScrollPane();
        admittedPatientData_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(204, 255, 204));
                }
                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(new Color(200, 225, 250));
                }
                return c;
            }
        };
        discharge_button = new StandardButton("Dischage");
        jPanel2 = new SimpleGradientPanel();
        jLayeredPane1 = new javax.swing.JLayeredPane();

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

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

        jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        admittedPatientData_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 [] {
                "MRN", "Patient Name", "Room Number", "Bed Number"
            }
        ));
        admittedPatientData_table.setRowHeight(21);
        admittedPatientData_table.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(admittedPatientData_table);

        discharge_button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        discharge_button.setText("Discharge");
        discharge_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                discharge_buttonActionPerformed(evt);
            }
        });

        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(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(discharge_button)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 435, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(discharge_button)
                .addContainerGap())
        );

        jSplitPane1.setLeftComponent(jPanel1);

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

        jLayeredPane1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.add(jLayeredPane1, java.awt.BorderLayout.CENTER);

        jSplitPane1.setRightComponent(jPanel2);

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

    private void discharge_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_discharge_buttonActionPerformed
        int row=admittedPatientData_table.getSelectedRow();
        if(row!=-1){
           showDischargeReport();
       
        }else{
            JOptionPane.showMessageDialog(null,"Select a Record to Discharge","Message",JOptionPane.INFORMATION_MESSAGE);
        }  
    }//GEN-LAST:event_discharge_buttonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable admittedPatientData_table;
    private javax.swing.JButton discharge_button;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSplitPane jSplitPane1;
    // End of variables declaration//GEN-END:variables
    private TInpatentAdmission inPatAdmission;
    private AvailableInpatientController availableInpatientController;
    private InPatientAdmissionController inPatientAdmissionController;
    private List<TInpatentAdmission> admittedPatientData = new ArrayList<TInpatentAdmission>();
    private DefaultTableModel model;
    private Vector<Object> addObject;
    private KeyEvent event;
    
    
    private void populate() {
        inPatAdmission = new TInpatentAdmission();
        availableInpatientController = (AvailableInpatientController)HealthCareInpatientHome.context.getBean("availableInpatientController");
        inPatientAdmissionController = (InPatientAdmissionController)HealthCareInpatientHome.context.getBean("inPatientAdmissionController");
    }
    
    private void displayAdmittedPatientList(){
        try{
            admittedPatientData = availableInpatientController.getInPatientList();
            admittedPatientData_table.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {"Id","InPatient ID","Patient Name", "Bed #"}));
            
            admittedPatientData_table.getColumnModel().getColumn(0).setPreferredWidth(0);
            admittedPatientData_table.getColumnModel().getColumn(0).setMinWidth(0);
            admittedPatientData_table.getColumnModel().getColumn(0).setMaxWidth(0);
            
            admittedPatientData_table.getColumnModel().getColumn(1).setMinWidth(90);
            admittedPatientData_table.getColumnModel().getColumn(1).setPreferredWidth(90);
            admittedPatientData_table.getColumnModel().getColumn(1).setMaxWidth(90);
            
            admittedPatientData_table.getColumnModel().getColumn(2).setMinWidth(130);
            admittedPatientData_table.getColumnModel().getColumn(2).setPreferredWidth(130);
            admittedPatientData_table.getColumnModel().getColumn(2).setMaxWidth(130);
            
            admittedPatientData_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
            admittedPatientData_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            model = (DefaultTableModel) admittedPatientData_table.getModel();    
            for(TInpatentAdmission admit:admittedPatientData){
                String patientFullName = null;
                if(admit.getPatientId().getPatientMName()!=null){
                    patientFullName = admit.getPatientId().getPatientFName()+" "+admit.getPatientId().getPatientMName()+" "+admit.getPatientId().getPatientLName();
                }else if(admit.getPatientId().getPatientMName()==null){
                    patientFullName = admit.getPatientId().getPatientFName()+" "+admit.getPatientId().getPatientLName();
                }
                addObject = new Vector<Object>();
                addObject.add(admit.getId());
                addObject.add(admit.getInpatientId());
                addObject.add(patientFullName);
                addObject.add(admit.getBedId().getBedNumber());
                model.addRow(addObject);
            }
         }catch(Exception e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Admitted Patient"}));
         }
    }
    
    private void showDischargeReport() {
        try {
            int row = admittedPatientData_table.getSelectedRow();
            Object o1= admittedPatientData_table.getValueAt(row, 0);
            inPatAdmission = inPatientAdmissionController.getInPatientAdmissionDetailByID(Long.valueOf(o1.toString()));
            jPanel2.removeAll();
            jPanel2.updateUI();
            jPanel2.add(new InPatient_DischargeReport_Panel(inPatAdmission),BorderLayout.CENTER);
            jPanel2.setVisible(true);
           // dischargeToggleButtonActionPerformed(null);
        } catch (Exception ex) {
            Logger.getLogger(RoundingPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

Commits for Aurocare_27_07_2018/AuroCareHealthCareInPatient/src/main/java/com/bestray/healthcareinpatient/view/InPatient_Discharge_Panel.java

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