1 package org
.therapi
.reha
.patient
;
3 import geraeteInit
.SMS
;
4 import hauptFenster
.Reha
;
5 import hauptFenster
.RehaIOMessages
;
6 import hauptFenster
.RehaIOServer
;
7 import hauptFenster
.ReverseSocket
;
9 import java
.awt
.Dimension
;
10 import java
.awt
.Point
;
11 import java
.awt
.event
.ActionEvent
;
12 import java
.awt
.event
.FocusEvent
;
13 import java
.awt
.event
.KeyEvent
;
14 import java
.awt
.event
.MouseEvent
;
15 import java
.util
.HashMap
;
18 import javax
.swing
.ImageIcon
;
19 import javax
.swing
.JComponent
;
20 import javax
.swing
.JLabel
;
21 import javax
.swing
.JList
;
22 import javax
.swing
.JOptionPane
;
30 import javax
.swing
.SwingUtilities
;
32 import org
.jdesktop
.swingworker
.SwingWorker
;
34 import CommonTools
.StringTools
;
35 import rechteTools
.Rechte
;
36 import systemEinstellungen
.SystemConfig
;
37 import systemTools
.IconListRenderer
;
38 import dialoge
.KuerzelNeu
;
39 import dialoge
.SMSDialog
;
40 import dialoge
.ToolsDialog
;
44 public class PatientToolBarLogic
{
45 PatientHauptPanel patientHauptPanel
= null;
46 PatientToolBarPanel patientToolBarPanel
= null;
47 public PatientToolBarLogic(PatientHauptPanel patientHauptPanel
,PatientToolBarPanel patientTbPanel
){
48 this.patientHauptPanel
= patientHauptPanel
;
49 this.patientToolBarPanel
= patientTbPanel
;
52 public void reactOnMouseClicked(MouseEvent arg0
){
53 if(arg0
.getSource() instanceof JLabel
){
54 if(((JComponent
)arg0
.getSource()).getName().equals("Suchen")){
55 if(patientHauptPanel
.inMemo
> -1){
56 Reha
.thisClass
.patpanel
.pmemo
[patientHauptPanel
.inMemo
].requestFocus();
59 patientHauptPanel
.starteSuche();
65 public void reactOnKeyPressed(KeyEvent e
){
66 if(e
.getKeyCode() == 10){
67 if(((JComponent
)e
.getSource()).getName() != null){
68 if( ((JComponent
) e
.getSource()).getName().equals("suchenach") ){
69 patientHauptPanel
.patientLogic
.starteSuche();
75 public void fireAufraeumen(){
76 for(int i
= 0; i
< patientHauptPanel
.jbut
.length
;i
++){
77 if(patientHauptPanel
.jbut
[i
] != null){
78 patientHauptPanel
.jbut
[i
].removeActionListener(patientHauptPanel
.toolBarAction
);
79 patientHauptPanel
.jbut
[i
] = null;
82 patientHauptPanel
.toolBarAction
= null;
83 patientHauptPanel
.tfsuchen
.removeKeyListener(patientHauptPanel
.toolBarKeys
);
84 patientHauptPanel
.toolBarKeys
= null;
85 patientToolBarPanel
.sucheLabel
.removeMouseListener(patientHauptPanel
.toolBarMouse
);
86 patientHauptPanel
.toolBarMouse
= null;
87 patientToolBarPanel
.sucheLabel
.removeFocusListener(patientHauptPanel
.toolBarFocus
);
88 patientHauptPanel
.tfsuchen
.removeFocusListener(patientHauptPanel
.toolBarFocus
);
89 patientHauptPanel
.tfsuchen
.getDropTarget().removeDropTargetListener(patientHauptPanel
.dropTargetListener
);
90 patientHauptPanel
.dropTargetListener
= null;
91 patientHauptPanel
.toolBarFocus
= null;
92 patientToolBarPanel
.sucheLabel
= null;
93 patientHauptPanel
= null;
96 public void reactOnFocusGained(FocusEvent e
){
97 if(((JComponent
)e
.getSource()).getName().equals("suchenach") && patientHauptPanel
.inMemo
> -1 ){
98 Reha
.thisClass
.patpanel
.pmemo
[patientHauptPanel
.inMemo
].requestFocus();
100 if(!patientHauptPanel
.getInternal().getActive()){
101 patientHauptPanel
.getInternal().setSpecialActive(true);
104 public void reactOnAction(ActionEvent arg0
){
105 String cmd
= arg0
.getActionCommand();
106 if(cmd
.equals("neu")){
107 patientHauptPanel
.getLogic().patNeu();
109 if(cmd
.equals("edit")){
110 patientHauptPanel
.getLogic().patEdit();
112 if(cmd
.equals("delete")){
113 patientHauptPanel
.getLogic().patDelete();
115 if(cmd
.equals("formulare")){
116 patientHauptPanel
.getLogic().patStarteFormulare();
117 //patientHauptPanel.getLogic().setzeFocus();
119 if(cmd
.equals("email")){
120 patientHauptPanel
.getLogic().setzeFocus();
122 if(cmd
.equals("sms")){
124 patientHauptPanel
.getLogic().setzeFocus();
126 if(cmd
.equals("werkzeuge")){
127 new ToolsDlgPatient("",patientHauptPanel
.jbut
[4].getLocationOnScreen());
128 //patientHauptPanel.getLogic().setzeFocus();
131 public void doPatNachricht(){
135 //hier Pat_intern und Rezeptnummer ermitteln
136 if(patientHauptPanel
.aktPatID
.equals("")){return;}
137 String spat_intern
= patientHauptPanel
.patDaten
.get(29);
138 String srez_nr
= "-1";
139 String sbetreff
= "Patient(in): "+StringTools
.EGross(patientHauptPanel
.patDaten
.get(2))+", "+StringTools
.EGross(patientHauptPanel
.patDaten
.get(3))+" PatID: "+spat_intern
;
140 if(Reha
.thisClass
.patpanel
.aktRezept
.tabaktrez
.getRowCount() > 0){
141 srez_nr
= Reha
.thisClass
.patpanel
.vecaktrez
.get(1);
143 if(! RehaIOServer
.rehaMailIsActive
){
144 if(Reha
.aktUser
.startsWith("Therapeut")){return;}
145 Reha
.thisFrame
.setCursor(Reha
.thisClass
.wartenCursor
);
147 new LadeProg(Reha
.proghome
+"RehaMail.jar"+" "+Reha
.proghome
+" "+Reha
.aktIK
+" "+Reha
.xport
+" "+Reha
.aktUser
.replace(" ", "#"));
148 long warten
= System
.currentTimeMillis();
149 while( (!RehaIOServer
.rehaMailIsActive
) && (System
.currentTimeMillis()-warten
< 15000)){
152 if(!RehaIOServer
.rehaMailIsActive
){
153 JOptionPane
.showMessageDialog(null,"Kann Thera-Pi Nachrichten nicht starten");
158 if(Reha
.aktUser
.startsWith("Therapeut")){return;}
159 new ReverseSocket().setzeRehaNachricht(RehaIOServer
.rehaMailreversePort
,"Reha#"+RehaIOMessages
.MUST_GOTOFRONT
);
161 new ReverseSocket().setzeRehaNachricht(RehaIOServer
.rehaMailreversePort
,"Reha#WANTPATMESSAGE#"+spat_intern
+"#"+srez_nr
+"#"+sbetreff
);
162 }catch(Exception ex
){
163 ex
.printStackTrace();
169 public void doPatFragebogen(){
171 if(patientHauptPanel
.aktPatID
.equals("")){return;}
172 String srez_nr
= "-1";
173 if(Reha
.thisClass
.patpanel
.aktRezept
.tabaktrez
.getRowCount() > 0){
174 srez_nr
= Reha
.thisClass
.patpanel
.vecaktrez
.get(1);
176 if(srez_nr
.isEmpty() || (!srez_nr
.startsWith("RH"))){
178 srez_nr
= Reha
.thisClass
.patpanel
.vecakthistor
.get(1);
179 }catch(Exception ex
){srez_nr
= "-1";}
182 final String spat_intern
= patientHauptPanel
.patDaten
.get(29);
183 final String xsrez_nr
= srez_nr
;
186 //System.out.println(Reha.proghome+"RehaFbBrowser.jar"+" ?patnummer="+spat_intern+"#reznummer="+xsrez_nr);
187 new LadeProg(Reha
.proghome
+"RehaFbBrowser.jar"+" ?pat_intern="+spat_intern
+"#rez_nr="+xsrez_nr
);
190 }catch(Exception ex
){
191 ex
.printStackTrace();
196 new SwingWorker
<Void
,Void
>(){
198 protected Void
doInBackground() throws Exception
{
200 //nur wenn SMS-Service aktiviert ist
201 if(SystemConfig
.activateSMS
&& (!patientHauptPanel
.aktPatID
.equals("")) && (SystemConfig
.hmSMS
.get("SMS").equals("1")) ){
202 //nur wenn einen Mobilfunknummer eingetragen ist
203 if(!patientHauptPanel
.patDaten
.get(20).isEmpty()){
204 Point pt
= patientHauptPanel
.jbut
[4].getLocationOnScreen();
205 String stitel
= ("SMS für Patient erstellen");
206 final SMSDialog smsDlg
= new SMSDialog(Reha
.thisFrame
,stitel
,PatientToolBarLogic
.this,true,"SMS über "+SystemConfig
.hmSMS
.get("NAME")+" an "+patientHauptPanel
.patDaten
.get(20),patientHauptPanel
.patDaten
.get(20));
207 smsDlg
.setPreferredSize(new Dimension(475,200));
208 smsDlg
.setLocation(pt
.x
-350,pt
.y
+100);
210 SwingUtilities
.invokeLater(new Runnable(){
212 smsDlg
.setTextCursor(0);
216 smsDlg
.setVisible(true);
217 SwingUtilities
.invokeLater(new Runnable(){
219 smsDlg
.setTextCursor(0);
223 JOptionPane
.showMessageDialog(null,"Keine Mobilfunknummer im Patientenstamm hinterlegt");
227 }catch(Exception ex
){
228 ex
.printStackTrace();
236 class ToolsDlgPatient
{
237 public ToolsDlgPatient(String command
,Point pt
){
238 Map
<Object
, ImageIcon
> icons
= new HashMap
<Object
, ImageIcon
>();
239 icons
.put("Patientenbezogene Nachricht erstellen",SystemConfig
.hmSysIcons
.get("patnachrichten"));
240 icons
.put("(e)Mail für Patient erstellen (Alt+M)",SystemConfig
.hmSysIcons
.get("email"));
241 icons
.put("SMS für Patient erstellen (Alt+S)",SystemConfig
.hmSysIcons
.get("sms"));
242 icons
.put("Zusatzinformationen zum aktuellen Patient (Alt+I)",SystemConfig
.hmSysIcons
.get("info"));
243 // create a list with some test data
244 JList list
= new JList( new Object
[] {"Patientenbezogene Nachricht erstellen",
245 "(e)Mail für Patient erstellen (Alt+M)",
246 "SMS für Patient erstellen (Alt+S)",
247 "Zusatzinformationen zum aktuellen Patient (Alt+I)"});
248 list
.setCellRenderer(new IconListRenderer(icons
));
249 Reha
.toolsDlgRueckgabe
= -1;
250 ToolsDialog tDlg
= new ToolsDialog(Reha
.thisFrame
,"Werkzeuge: aktueller Patient",list
);
251 tDlg
.setPreferredSize(new Dimension(300,200+
252 ((Boolean
)SystemConfig
.hmPatientenWerkzeugDlgIni
.get("ToolsDlgShowButton")?
25 : 0) ));
253 tDlg
.setLocation(pt
.x
-200,pt
.y
+30);
256 tDlg
.activateListener();
257 tDlg
.setVisible(true);
258 switch(Reha
.toolsDlgRueckgabe
){
263 if(!Rechte
.hatRecht(Rechte
.Patient_email
, true)){
268 if(!Rechte
.hatRecht(Rechte
.Patient_sms
, true)){
275 if(!Rechte
.hatRecht(Rechte
.Patient_zusatzinfo
, true)){