package ch.elexis.base.ch.diagnosecodes.util;

import ch.elexis.core.data.events.ElexisEventDispatcher;
import ch.elexis.core.ui.util.IKonsMakro;
import ch.elexis.data.Konsultation;
import ch.elexis.data.TICode;

public class TIMakro implements IKonsMakro {
	
	public TIMakro(){
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public String executeMakro(String makro){
		Konsultation actKons = (Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
		
		TICode tiCode = TICode.getFromCode(makro);
		if (tiCode != null) {
			actKons.addDiagnose(tiCode);
		}
		
		return "";
	}
	
}

@@ -40,16 +40,74 @@
 .util;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A
 import c
@@ -151,24 +151,24 @@
 Dispatcher;%0A
-
 import ch.el
@@ -311,16 +311,90 @@
 kro %7B%0A%09%0A
+%09private static Logger logger = LoggerFactory.getLogger(TIMakro.class);%0A%09%0A
 %09public 
@@ -603,16 +603,25 @@
 ss);%0A%09%09%0A
+%09%09try %7B%0A%09
 %09%09TICode
@@ -657,16 +657,17 @@
 makro);%0A
+%09
 %09%09if (ti
@@ -685,16 +685,17 @@
 l) %7B%0A%09%09%09
+%09
 actKons.
@@ -715,16 +715,109 @@
 iCode);%0A
+%09%09%09%7D%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09logger.debug(%22Could not resolve TI Code %5B%22 + makro + %22%5D%22);%0A
 %09%09%7D%0A%09%09%0A%09

fix TIMakro handling non TI code makros