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
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
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareinpatient.view;

import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.DisabledGlassPane;
import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.util.StandardButton;
import com.bestray.healthcarecommonutil.vo.TBedMaster;
import com.bestray.healthcarecommonutil.vo.TCCodeValues;
import com.bestray.healthcarecommonutil.vo.TDepartmentMaster;
import com.bestray.healthcarecommonutil.vo.TDoctorInformation;
import com.bestray.healthcarecommonutil.vo.TInpatentAdmission;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcarecommonutil.vo.TRoomMaster;
import com.bestray.healthcareinpatient.controller.InPatientAdmissionController;
import com.bestray.healthcareinpatient.controller.InPatientCodeValuesController;
import com.bestray.healthcareinpatient.controller.InPatientRoundingController;
import com.bestray.healthcareinpatient.reports.InpatientAdmsnReport;
import com.bestray.healthcareinpatient.util.CollectionUtill;
import com.bestray.healthcareinpatient.util.MessageProperties;
import java.awt.Color;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;

/**
 *
 * @author User1
 */
public class InPatient_Admission_panel extends SimpleGradientPanel {

    /**
     * Creates new form InPatient_Admission_panel
     */
    public InPatient_Admission_panel() {
        populateData();
        initComponents();
        
    }
    
    public InPatient_Admission_panel(TPatient patient) {
        populateData();
        initComponents();
        showPatientInfo(patient);
       
        
    }

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

        jPanel2 = new SimpleGradientPanel(Color.LIGHT_GRAY, Color.WHITE);
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        patid_label = new javax.swing.JLabel();
        patName_label = new javax.swing.JLabel();
        patDOB_label = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        patGender_label = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        admission_patient_search_button = new javax.swing.JButton();
        patient_reset_button = new javax.swing.JButton();
        patient_detail_button = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        days_label = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        inPatientID_textbox = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        admissionType_combobox = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        admitingDoctor_combobox = new javax.swing.JComboBox();
        department_combobox = new javax.swing.JComboBox();
        jLabel15 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        roomType_combox = new javax.swing.JComboBox();
        jLabel16 = new javax.swing.JLabel();
        admitingRoom_combobox = new javax.swing.JComboBox();
        jLabel17 = new javax.swing.JLabel();
        ipdNo_textbox = new javax.swing.JTextField();
        bed_search_button = new javax.swing.JButton();
        jLabel20 = new javax.swing.JLabel();
        admitingUser_texbox = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        patient_disease_textArea = new javax.swing.JTextArea();
        save_button = new StandardButton("Save");
        reset_button = new StandardButton("Reset");
        admission_dateChooser = new com.toedter.calendar.JDateChooser();
        jLabel23 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        patient_note_textArea = new javax.swing.JTextArea();
        jLabel1 = new javax.swing.JLabel();
        admitingBed_textbox1 = new javax.swing.JTextField();

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jPanel2.setOpaque(false);

        jLabel2.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        jLabel2.setText("MRN #");

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

        jLabel5.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        jLabel5.setText("DOB :");

        patid_label.setFont(new java.awt.Font("SansSerif", 0, 13)); // NOI18N
        patid_label.setForeground(new java.awt.Color(255, 0, 0));

        patName_label.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
        patName_label.setForeground(new java.awt.Color(0, 102, 255));

        patDOB_label.setFont(new java.awt.Font("SansSerif", 0, 13)); // NOI18N
        patDOB_label.setForeground(new java.awt.Color(0, 102, 255));

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(67, 45, 247));
        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Patients-icon 24X24.png"))); // NOI18N
        jLabel8.setText("Patient Details");

        jLabel6.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        jLabel6.setText("Gender :");

        patGender_label.setFont(new java.awt.Font("SansSerif", 0, 13)); // NOI18N
        patGender_label.setForeground(new java.awt.Color(0, 102, 255));

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);
        jToolBar1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jToolBar1.setOpaque(false);

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

        patient_reset_button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        patient_reset_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/refresh 16x16.png"))); // NOI18N
        patient_reset_button.setMargin(new java.awt.Insets(2, 20, 2, 20));
        patient_reset_button.setOpaque(false);
        patient_reset_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                patient_reset_buttonActionPerformed(evt);
            }
        });
        jToolBar1.add(patient_reset_button);

        patient_detail_button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        patient_detail_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/patient Info 16.png"))); // NOI18N
        patient_detail_button.setMargin(new java.awt.Insets(2, 20, 2, 20));
        patient_detail_button.setOpaque(false);
        patient_detail_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                patient_detail_buttonActionPerformed(evt);
            }
        });
        jToolBar1.add(patient_detail_button);

        jLabel7.setFont(new java.awt.Font("SansSerif", 1, 13)); // NOI18N
        jLabel7.setText("Days :");

        days_label.setFont(new java.awt.Font("SansSerif", 0, 13)); // NOI18N
        days_label.setForeground(new java.awt.Color(0, 102, 255));

        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()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(patid_label, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(patName_label, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(patDOB_label, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel8))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(patGender_label, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(days_label, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(20, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(2, 2, 2)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(patid_label, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(patName_label))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(patDOB_label, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(patGender_label, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(days_label, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {days_label, jLabel2, jLabel3, jLabel5, jLabel6, jLabel7, patDOB_label, patGender_label, patName_label, patid_label});

        jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel8, jToolBar1});

        jPanel1.setOpaque(false);

        jLabel13.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel13.setText("In-Patient# :");

        inPatientID_textbox.setEditable(false);
        inPatientID_textbox.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        inPatientID_textbox.setForeground(new java.awt.Color(255, 0, 0));
        inPatientID_textbox.setOpaque(false);

        jLabel14.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel14.setText("Admission Type :");

        admissionType_combobox.setModel(new javax.swing.DefaultComboBoxModel(admissionTypeList));

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

        admitingDoctor_combobox.setModel(new javax.swing.DefaultComboBoxModel(doctorList));

        department_combobox.setModel(new javax.swing.DefaultComboBoxModel(departmentList));
        department_combobox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                department_comboboxItemStateChanged(evt);
            }
        });
        department_combobox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                department_comboboxActionPerformed(evt);
            }
        });

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

        jLabel19.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel19.setText("Room Type");

        roomType_combox.setModel(new javax.swing.DefaultComboBoxModel(admissionRoomTypeList));
        roomType_combox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                roomType_comboxItemStateChanged(evt);
            }
        });
        roomType_combox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                roomType_comboxActionPerformed(evt);
            }
        });

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

        admitingRoom_combobox.setModel(new javax.swing.DefaultComboBoxModel(admissionRoomList));
        admitingRoom_combobox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                admitingRoom_comboboxActionPerformed(evt);
            }
        });

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

        ipdNo_textbox.setEditable(true);
        ipdNo_textbox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ipdNo_textboxActionPerformed(evt);
            }
        });

        bed_search_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search-icon16X16.png"))); // NOI18N
        bed_search_button.setContentAreaFilled(false);
        bed_search_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bed_search_buttonActionPerformed(evt);
            }
        });

        jLabel20.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel20.setText("Admission Date :");

        jLabel21.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel21.setText("Admiting User :");

        jLabel22.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel22.setText("Indication/Disease :");
        jLabel22.setVisible(false);

        patient_disease_textArea.setColumns(20);
        patient_disease_textArea.setVisible(false);
        patient_disease_textArea.setRows(5);
        jScrollPane1.setViewportView(patient_disease_textArea);
        jScrollPane1.setVisible(false);

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

        reset_button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        reset_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/refresh 16x16.png"))); // NOI18N
        reset_button.setText("Reset");
        reset_button.setOpaque(false);
        reset_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reset_buttonActionPerformed(evt);
            }
        });

        admission_dateChooser.setDateFormatString("dd/MM/yyyy");
        admission_dateChooser.setDate(new Date());

        jLabel23.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel23.setText("Treatment Plan/O.T Note :");
        jLabel23.setVisible(false);

        patient_note_textArea.setColumns(20);
        patient_note_textArea.setVisible(false);
        patient_note_textArea.setRows(5);
        jScrollPane2.setViewportView(patient_note_textArea);
        jScrollPane2.setVisible(false);

        jLabel1.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel1.setText("IPD. NO :");

        admitingBed_textbox1.setEditable(false);

        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(42, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(admitingDoctor_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(department_combobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(inPatientID_textbox)
                                .addComponent(admissionType_combobox, 0, 177, Short.MAX_VALUE))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ipdNo_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(10, 10, 10)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16)
                    .addComponent(jLabel17)
                    .addComponent(jLabel21))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(admission_dateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(roomType_combox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(admitingRoom_combobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(admitingBed_textbox1, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(bed_search_button, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 44, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel23)
                            .addComponent(jLabel22)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(reset_button)
                                .addGap(18, 18, 18)
                                .addComponent(save_button))
                            .addComponent(admitingUser_texbox, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)
                    .addComponent(jScrollPane2))
                .addContainerGap(110, Short.MAX_VALUE))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel16, jLabel17, jLabel19, jLabel20});

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jScrollPane1, jScrollPane2});

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {admissionType_combobox, admitingDoctor_combobox, department_combobox});

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {admission_dateChooser, admitingRoom_combobox, ipdNo_textbox, roomType_combox});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(inPatientID_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel13))
                    .addComponent(jLabel20)
                    .addComponent(admission_dateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel22)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel19)
                                .addComponent(ipdNo_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel1))
                            .addComponent(roomType_combox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel16)
                                .addComponent(admitingRoom_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel14)
                                    .addComponent(admissionType_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(admitingBed_textbox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(department_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel21)
                            .addComponent(admitingUser_texbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(reset_button)
                            .addComponent(save_button)))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel23)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(bed_search_button)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel15)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel18)
                                .addComponent(admitingDoctor_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(46, Short.MAX_VALUE))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {admissionType_combobox, admission_dateChooser, admitingDoctor_combobox, admitingRoom_combobox, admitingUser_texbox, bed_search_button, department_combobox, inPatientID_textbox, ipdNo_textbox, jLabel13, jLabel14, jLabel15, jLabel16, jLabel17, jLabel18, jLabel19, jLabel20, jLabel21, jLabel22, roomType_combox});

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

    private void patient_reset_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_patient_reset_buttonActionPerformed
        clearPatientInfo();
    }//GEN-LAST:event_patient_reset_buttonActionPerformed

    private void admission_patient_search_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_admission_patient_search_buttonActionPerformed
        DisabledGlassPane glassPane = new DisabledGlassPane();
        JRootPane rootPane = SwingUtilities.getRootPane(this);
        rootPane.setGlassPane(glassPane);
        PatientLookUpDialog lookUpDialoge = new PatientLookUpDialog(MainAPP, true, "ADMISSION");
        lookUpDialoge.setResizable(false);
        lookUpDialoge.setLocationRelativeTo(null);
        glassPane.activate("");
        lookUpDialoge.setVisible(true);
        lookUpDialoge.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        glassPane.deactivate();
        if(PatientRecordDialog.patient!=null){
                patient = PatientRecordDialog.patient;
                PatientRecordDialog.patient = null;
                showPatientInfo(patient);
            }else if(PatientLookUpDialog.patient!=null){
                patient = PatientLookUpDialog.patient;
                PatientLookUpDialog.patient = null;
                showPatientInfo(patient);
            }
    }//GEN-LAST:event_admission_patient_search_buttonActionPerformed

    private void patient_detail_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_patient_detail_buttonActionPerformed
        DisabledGlassPane glassPane = new DisabledGlassPane();
        JRootPane rootPane = SwingUtilities.getRootPane(this);
        rootPane.setGlassPane(glassPane);
        PatienInformationDialog patInfoDialoge = new PatienInformationDialog(MainAPP, true, patient);
        patInfoDialoge.setResizable(false);
        patInfoDialoge.setLocationRelativeTo(null);
        glassPane.activate("");
        patInfoDialoge.setVisible(true);
        patInfoDialoge.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        glassPane.deactivate();
    }//GEN-LAST:event_patient_detail_buttonActionPerformed

    private void bed_search_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bed_search_buttonActionPerformed
        if(admitingRoom_combobox.getSelectedItem()!=null){
            TRoomMaster room = (TRoomMaster)admitingRoom_combobox.getSelectedItem();
            try{
                room = inPatientAdmissionController.getRoomValues(room.getId());
            }catch(ProcessingException e){
                JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"department"}));
                throw new HealthCareException(MessageProperties.getMessage("error.dao"));
            }
            DisabledGlassPane glassPane = new DisabledGlassPane();
            JRootPane rootPane = SwingUtilities.getRootPane(this);
            rootPane.setGlassPane(glassPane);
            BedAllocationDialog bedAllocationDialog = new BedAllocationDialog(MainAPP, true, room);
            bedAllocationDialog.setResizable(false);
            bedAllocationDialog.setLocationRelativeTo(null);
            glassPane.activate("");
            bedAllocationDialog.setVisible(true);
            bedAllocationDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            glassPane.deactivate();
            if(bedAllocationDialog.bed!=null){
                showBedInformation(bedAllocationDialog.bed);
            }
        }
    }//GEN-LAST:event_bed_search_buttonActionPerformed

    private void save_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_buttonActionPerformed
      if(validateAdmissionSave()){
        try {
            inPatientId = inPatientAdmissionController.getInPatientId();
            inpatentAdmission.setInpatientId(inPatientId);
            inpatentAdmission.setIpdNo(ipdNo_textbox.getText());
            inpatentAdmission.setPatientId(patient);
            TDoctorInformation
                    doctor = (TDoctorInformation)admitingDoctor_combobox.getSelectedItem();
            inpatentAdmission.setDoctorId(inPatientAdmissionController.findDoctorDetailsById(doctor.getId()));
            inpatentAdmission.setBedId(bed);
            inpatentAdmission.setAdmissionDate(admission_dateChooser.getDate());
            inpatentAdmission.setAdmittedBy(admitingUser_texbox.getText());
            inpatentAdmission.setAdmissionType(String.valueOf(admissionType_combobox.getSelectedItem()));
            inpatentAdmission.setInpatientStatus("ADMITTED");
            inpatentAdmission.setPatientNote(patient_note_textArea.getText());
            inpatentAdmission.setPatientDisease(patient_disease_textArea.getText());
            //if(inPatientAdmissionController.checkAvailablePatient(inpatentAdmission.getPatientId())){
                //JOptionPane.showMessageDialog(null, "patient is already admitted in hospital.");
           // }else{
                TPatientEncounter inpatenc = getOrCreateIPEncounter(inpatentAdmission);
                inpatentAdmission.setEncounter(inpatenc);
                inPatientAdmissionController.saveInPatientAdmission(inpatentAdmission);
                JOptionPane.showMessageDialog(null, "Patient admission information has been saved.");
                clearScreen();
                //InpatientAdmsnReport admissionReport = new InpatientAdmsnReport();
                //admissionReport.getPdfReport(inpatentAdmission.getId(),inpatentAdmission.getInpatientId());
                //admissionReport.openPdfReport();
                InPatientHomePanel.scheduleToggleButton.doClick();
           // }
        }catch(HibernateOptimisticLockingFailureException e){
            JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.update",new Object[]{"In-Patient Admission"}));
        }catch(ProcessingException e){
            JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"In-Patient Admission"}));
            throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }catch(Exception e){
            JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"In-Patient Admission"}));
        }
      }
    }//GEN-LAST:event_save_buttonActionPerformed

    private void reset_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reset_buttonActionPerformed
        resetAdmissionProcess();
    }//GEN-LAST:event_reset_buttonActionPerformed
//private TDepartmentMaster department;
    private void department_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_department_comboboxItemStateChanged
        if(department_combobox.getSelectedItem()!=null){
        TDepartmentMaster dept = (TDepartmentMaster)department_combobox.getSelectedItem();
            
            try{
                department = inPatientAdmissionController.getDepartmentbyID(dept.getId());
                System.out.println("Dept Id:"+department.getId());
                admissionRoomTypeList = inPatientAdmissionController.getRoomTypesByDept(department);
                for(String roomTypes:admissionRoomTypeList){
                    System.out.println("RoomTypes"+roomTypes);
                }
                doctorList = inPatientAdmissionController.getDoctorsByDepartment(department);
                for(TDoctorInformation doctorinfo:doctorList){
                    System.out.println("DoctorList:-------"+doctorinfo.getDoctor_name());
                }
                admitingDoctor_combobox.setModel(new javax.swing.DefaultComboBoxModel(doctorList));
                admitingDoctor_combobox.setSelectedIndex(-1);
                roomType_combox.setModel(new javax.swing.DefaultComboBoxModel(admissionRoomTypeList));
                roomType_combox.setSelectedIndex(-1);
            }catch(ProcessingException e){
                JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"department"}));
                throw new HealthCareException(MessageProperties.getMessage("error.dao"));
            }
        }
    }//GEN-LAST:event_department_comboboxItemStateChanged

    private void roomType_comboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_roomType_comboxItemStateChanged
        if(roomType_combox.getSelectedItem()!=null){
            try{
                
                //admissionRoomList = inPatientAdmissionController.getRoomsByDeptRoomType(String.valueOf(roomType_combox.getSelectedItem()), inPatientAdmissionController.getDepartmentByName("MEDICINE"));
                admissionRoomList = inPatientAdmissionController.getRoomsByDeptRoomType(String.valueOf(roomType_combox.getSelectedItem()), inPatientAdmissionController.getDepartmentByName(String.valueOf(department_combobox.getSelectedItem())));
                
          // admissionRoomList = inPatientAdmissionController.getRoomsByDeptRoomType(String.valueOf(roomType_combox.getSelectedItem()),department);
            }catch(ProcessingException e){
                JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"department"}));
                throw new HealthCareException(MessageProperties.getMessage("error.dao"));
            }
            admitingRoom_combobox.setModel(new javax.swing.DefaultComboBoxModel(admissionRoomList));
            admitingRoom_combobox.setSelectedIndex(-1);
        }
    }//GEN-LAST:event_roomType_comboxItemStateChanged

    private void admitingRoom_comboboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_admitingRoom_comboboxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_admitingRoom_comboboxActionPerformed

    private void roomType_comboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_roomType_comboxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_roomType_comboxActionPerformed

    private void department_comboboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_department_comboboxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_department_comboboxActionPerformed

    private void ipdNo_textboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ipdNo_textboxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ipdNo_textboxActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox admissionType_combobox;
    private com.toedter.calendar.JDateChooser admission_dateChooser;
    public static javax.swing.JButton admission_patient_search_button;
    private javax.swing.JTextField admitingBed_textbox1;
    private javax.swing.JComboBox admitingDoctor_combobox;
    private javax.swing.JComboBox admitingRoom_combobox;
    private javax.swing.JTextField admitingUser_texbox;
    private javax.swing.JButton bed_search_button;
    private javax.swing.JLabel days_label;
    private javax.swing.JComboBox department_combobox;
    private javax.swing.JTextField inPatientID_textbox;
    private javax.swing.JTextField ipdNo_textbox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JLabel patDOB_label;
    private javax.swing.JLabel patGender_label;
    private javax.swing.JLabel patName_label;
    private javax.swing.JLabel patid_label;
    private javax.swing.JButton patient_detail_button;
    private javax.swing.JTextArea patient_disease_textArea;
    private javax.swing.JTextArea patient_note_textArea;
    private javax.swing.JButton patient_reset_button;
    private javax.swing.JButton reset_button;
    private javax.swing.JComboBox roomType_combox;
    private javax.swing.JButton save_button;
    // End of variables declaration//GEN-END:variables
    private javax.swing.JFrame MainAPP;
    /** The In-patient id. */
    String inPatientId;
    
    /** The department list. */
    private Vector<TDepartmentMaster> departmentList = new Vector<TDepartmentMaster>();
    /** The Code Value list. */
    private Vector<TCCodeValues> admissionTypeList = new Vector<TCCodeValues>();
    /** The Doctor list. */
    private Vector<TDoctorInformation> doctorList = new Vector<TDoctorInformation>();
    /** The Admission Room Type list. */
    private Vector<String> admissionRoomTypeList = new Vector<String>();
    /** The Admission Room Type list. */
    private Vector<TRoomMaster> admissionRoomList = new Vector<TRoomMaster>();
    /** The In-Patient Admission controller. */
    private InPatientAdmissionController inPatientAdmissionController;
    /** The In-Patient Code Value controller. */
    private InPatientCodeValuesController inPatientCodeValuesController;
    private InPatientRoundingController inPatientRoundingController;
    private SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
    private TPatient patient;
    private TDepartmentMaster department;
    private TBedMaster bed;  
    private TInpatentAdmission inpatentAdmission;
    
    private void populateData() {
        bed = new TBedMaster();
        patient = new TPatient();
        department = new TDepartmentMaster();
        inpatentAdmission = new TInpatentAdmission();
        inPatientAdmissionController = (InPatientAdmissionController)HealthCareInpatientHome.context.getBean("inPatientAdmissionController");
        inPatientCodeValuesController = (InPatientCodeValuesController)HealthCareInpatientHome.context.getBean("inPatientCodeValuesController");
        inPatientRoundingController = (InPatientRoundingController)HealthCareInpatientHome.context.getBean("inPatientRoundingController");
     }

    private void showPatientInfo(TPatient patient) {
        if(patient!=null){
        patid_label.setText(patient.getPatientId());
        String patientFullName = null;
            if(patient.getPatientMName()!=null){
                    patientFullName = patient.getPatientFName()+" "+patient.getPatientMName()+" "+patient.getPatientLName();
                }else if(patient.getPatientMName()==null){
                    patientFullName = patient.getPatientFName()+" "+patient.getPatientLName();
                }
            patName_label.setText(patientFullName);
            patGender_label.setText(patient.getPatientGender());
            patDOB_label.setText(String.valueOf(sdf.format(patient.getBirthDate())));
            startAdmissionProcess();
        }
    }
    
    private void startAdmissionProcess(){
        admitingUser_texbox.setText(CollectionUtill.showCurrentUser());
        try{
            departmentList = inPatientAdmissionController.getDepartmentList();
            department_combobox.setModel(new javax.swing.DefaultComboBoxModel(departmentList));
            department_combobox.setSelectedIndex(-1);
            admissionTypeList = inPatientCodeValuesController.getCodeValues("ADMISSION TYPE");
            //For checking Admission Type
            for(TCCodeValues admissionType:admissionTypeList){
                System.out.println("Admission TypeList"+admissionType.getCodeValueName());
            }
            admissionType_combobox.setModel(new javax.swing.DefaultComboBoxModel(admissionTypeList));
            admissionType_combobox.setSelectedIndex(-1);
            //According to KNH business rule :
          //admissionRoomTypeList = inPatientAdmissionController.getRoomTypesByDept(inPatientAdmissionController.getDepartmentByName("MEDICINE"));
            //admissionRoomTypeList = inPatientAdmissionController.getRoomTypesByDept(inPatientAdmissionController.getDepartmentbyID(department.getId()));
            // admissionRoomTypeList = inPatientAdmissionController.getRoomTypesByDept(department);
            
            String dept_name = (department_combobox.getSelectedItem().toString() !=null)? department_combobox.getSelectedItem().toString() : "UNKNOWN";
            
            admissionRoomTypeList = inPatientAdmissionController.getRoomTypesByDept(inPatientAdmissionController.getDepartmentByName(dept_name));
            //admissionRoomTypeList = inPatientAdmissionController.getRoomTypesByDept(inPatientAdmissionController.getDepartmentByName("PAEDIATRIC"));
            for(int i=0;i<admissionRoomTypeList.size();i++){
                System.out.println("RoomType List"+admissionRoomTypeList.get(i).toString());
            }
            roomType_combox.setModel(new javax.swing.DefaultComboBoxModel(admissionRoomTypeList));
            roomType_combox.setSelectedIndex(-1);
            //doctorList = inPatientAdmissionController.getAllDoctorList();
            //admitingDoctor_combobox.setModel(new javax.swing.DefaultComboBoxModel(doctorList));
            //admitingDoctor_combobox.setSelectedIndex(-1);
        }catch(ProcessingException e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"information"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
         }
    }

    private void showBedInformation(TBedMaster bed) {
        this.bed = bed;
        //ipdNo_textbox.setText(bed.getBedNumber());
        admitingBed_textbox1.setText(bed.getBedNumber());
        System.out.println("%%%%%% print bed no : "+bed.getBedNumber());
    }

    private void resetAdmissionProcess() {
        admissionType_combobox.setSelectedIndex(-1);
        admitingDoctor_combobox.setSelectedIndex(-1);
        admission_dateChooser.setDate(null);
        department_combobox.setSelectedIndex(-1);
        roomType_combox.setSelectedIndex(-1);
        admitingRoom_combobox.setSelectedIndex(-1);
        admitingUser_texbox.setText("");
        ipdNo_textbox.setText("");
        patient_disease_textArea.setText("");
        patient_note_textArea.setText("");
        bed = new TBedMaster();
        department = new TDepartmentMaster();
    }

    private void clearScreen() {
        clearPatientInfo();
        resetAdmissionProcess();
    }

    private void clearPatientInfo() {
        patid_label.setText("");
        patName_label.setText("");
        patGender_label.setText("");
        patDOB_label.setText("");
        patient = null;
    }
    
    private TPatientEncounter getOrCreateIPEncounter(TInpatentAdmission inpatadmission) {
        try{
            TPatientEncounter inpatenc = inPatientRoundingController.getIPEncounterByPatient(inpatadmission.getPatientId());
            if(inpatenc!=null){
                inpatenc = inPatientRoundingController.saveIPEncounter(true,inpatenc);
            }else{
                inpatenc = new TPatientEncounter();
                inpatenc.setPatient(inpatadmission.getPatientId());
                inpatenc.setDoctor(inpatadmission.getDoctorId());
                inpatenc = inPatientRoundingController.saveIPEncounter(false,inpatenc);
            }
            return inpatenc;
        }catch(Exception ex){
            Logger.getLogger(RoundingPanel.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    private boolean validateAdmissionSave() {
        boolean flag = true;
        if(patid_label.getText().length()==0){
            flag = false;
            JOptionPane.showMessageDialog(null,"Select a Patient for admission.");
        }else if(admission_dateChooser.getDate()==null){
            flag = false;
            admission_dateChooser.requestFocus();
            JOptionPane.showMessageDialog(null,"Admission date should be selected.");
        }else if(admitingUser_texbox.getText().length()==0){
            flag = false;
            admitingUser_texbox.requestFocus();
            JOptionPane.showMessageDialog(null,"Enter an Admitting user.");
        }else if(admissionType_combobox.getSelectedItem()==null){
            flag = false;
            admissionType_combobox.requestFocus();
            JOptionPane.showMessageDialog(null,"Admission Type should be selected.");
        }else if(department_combobox.getSelectedItem()==null){
            flag = false;
            department_combobox.requestFocus();
            JOptionPane.showMessageDialog(null,"Select a Department name.");
        }else if(admitingDoctor_combobox.getSelectedItem()==null){
            flag = false;
            admitingDoctor_combobox.requestFocus();
            JOptionPane.showMessageDialog(null,"Select a Doctor name.");
        }else if(roomType_combox.getSelectedItem()==null){
            flag = false;
            roomType_combox.requestFocus();
            JOptionPane.showMessageDialog(null,"Select a Room type.");
        }else if(admitingRoom_combobox.getSelectedItem()==null){
            flag = false;
            admitingRoom_combobox.requestFocus();
            JOptionPane.showMessageDialog(null,"Select a Room name.");
        }
//        else if(ipdNo_textbox.getText().length()==0){
//            flag = false;
//            ipdNo_textbox.requestFocus();
//            JOptionPane.showMessageDialog(null,"Select a Bed.");
//        }
        return flag;
    }

}

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

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