Calling Terminology Browser from other Apps

Aus Termserver-CTS2
Wechseln zu: Navigation, Suche

This site shows you how to call the Terminology Browser from another ZK application. It is possible to call it from any javascript app, therefore you have to change the code.

Inhaltsverzeichnis

Call Terminology Browser

URI

You can show the Terminology Browser in another app with showing:

http://localhost:8080/TermBrowser/gui/main/main.zul

You have to replace localhost with your instance of the Terminology Server. Please see the next section for available parameters.

Parameter

You can add the following parameters when you open the Browser.

Parameter Possible values Description
loadType "CodeSystem", "CS", "ValueSet", "VS" Specifies whether to open a code system or a value set. This parameter is required.
hideSelection 0, 1 Hides the code system selection on the left side. Default: 0
hideMenu 0, 1 Hides the menu on the top. Default: 0
hideStatusbar 0, 1 Hides the statusbar in the bottom. Default: 0
hideVersion 0, 1 Hides the version box at the top. Default: 0
sendBack false, true Shows the button "assume concept" and sends the concept information back to the calling app. Default: false
loadName String The name of a codesystem to show. The current version will be shown. (either loadId, loadName or loadOID is required)
loadId Number The codesystem version id from the Terminology Server. (either loadId, loadName or loadOID is required)
loadOID String The OID of the codesystem version. (either loadId, loadName or loadOID is required)
search false, true true, if search field should be displayed automatically. Default: false
rootConceptCode code Can be used in hierachical systems to show concepts only from one axis.
filterTaxonomyId Number Filter the taxonomy with a given domain value id.

Example call: http://localhost:8080/TermBrowser/gui/main/main.zul?loadType=CodeSystem&loadName=ICD&hideMenu=1&hideStatusbar=1&hideSelection=1&sendBack=true

Results

The result is a string with comma separated values.

For example an icd result looks like: code=XXII;versionId=232692;term=U2NobPxzc2VsbnVtbWVybiBm/HIgYmVzb25kZXJlIFp3ZWNrZQ==

The following values are returned.

Parameter Format Description
code String The code
versionId Long The version id of the concept
term base64 The term of a concept as a base64 encoded String
description base64 The description of a concept as a base64 encoded String

Call Terminology Browser from a ZK app

This example requires a zul file and java file behind.

Window (ZUL)

Insert the following code into your zul file inside the window tag.

<zk xmlns="http://www.zkoss.org/2005/zul">
  <window id="window" border="none" height="100%" width="100%" use="de.fhdo.gui.SendBackTest">
 
    <script type="text/javascript">
      function receiveMessage(event)
      {               
        var widgetMainWindow = zk.Widget.$('$mainWindow');
        var e = new zk.Event(widgetMainWindow, "onSendBack", event.data);                                
        zAu.send(e);                          
      }
 
      window.addEventListener("message", receiveMessage, false);
    </script>
 
    <button label="Öffne ICD..." onClick="window.openCodesystem()"/>
  </window>
</zk>

Code (java)

Insert this code into your java file to receive the answer message and to call the Browser in a modal window.

import org.apache.tomcat.util.codec.binary.Base64;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Iframe;
import org.zkoss.zul.Window;
 
/**
 *
 * @author Robert Mützner <robert.muetzner@fh-dortmund.de>
 */
public class SendBackTest extends Window
{
  private Window wBrowser;
 
  public SendBackTest()
  {
 
  }
 
  public void openCodesystem()
  {
    System.out.println("openCodesystem()");
 
    wBrowser = new Window();
    openBrowser("Diagnose auswählen", "ICD", "onSendBack", wBrowser, this);
  }
 
  public static void openBrowser(String title, String codeSystemName, String sendbackMethodName, Window wBrowser, Window parent)
  {
    String uri = "http://localhost:8080/TermBrowser/gui/main/main.zul?loadType=CodeSystem&loadName=ICD&hideMenu=1&hideStatusbar=1&hideSelection=1&sendBack=true";
 
    // create window
    wBrowser.setHeight("90%");
    wBrowser.setWidth("90%");
    wBrowser.setClosable(true);
    wBrowser.setTitle(title);
    wBrowser.setBorder("normal");
 
    Iframe iFrame = new Iframe();
    iFrame.setHeight("100%");
    iFrame.setWidth("100%");
    iFrame.setSrc(uri);
    iFrame.setParent(wBrowser);
    wBrowser.appendChild(iFrame);
    parent.appendChild(wBrowser);
 
    try
    {
      wBrowser.doModal();
    }
    catch (Exception ex)
    {
      ex.printStackTrace();
    }
  }
 
  /**
   * This method is called from the Terminology Browser when a concept is selected
   * and send back. The result is in the data string, the values are comma separated.
   * Term and description are base64 encoded.
   * 
   * @param e 
   */
  public void onSendBack(Event e)
  {
    System.out.println("onSendBack()");
    try
    {
      Object str = e.getData();
      System.out.println("str: " + str);
 
      String s_array[] = str.toString().split(";");
      for(String s_part : s_array)
      {
        String s[] = s_part.split("=");
        if(s != null && s.length == 2)
        {
          String s_result = "";
 
          if(s[0].equalsIgnoreCase("term") || s[0].equalsIgnoreCase("description"))
            s_result = new String(Base64.decodeBase64(s[1]));
          else s_result = s[1];
 
          System.out.println(s[0] + ": " + s_result);
        }
      }
    }
    catch (Exception ex)
    {
      ex.printStackTrace();
    }
 
    wBrowser.detach();
  }
}
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Werkzeuge