List of usage examples for com.google.gwt.http.client RequestBuilder POST
Method POST
To view the source code for com.google.gwt.http.client RequestBuilder POST.
Click Source Link
From source file:org.freemedsoftware.gwt.client.widget.EMRModuleWidget.java
License:Open Source License
@Override public void getTextForValue(Integer val) { if (Util.getProgramMode() == ProgramMode.STUBBED) { searchBox.setText("Hackenbush, Hugo Z (STUB)"); } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { moduleName, val.toString() }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.api.ModuleInterface.ModuleToTextMethod", params))); try {/*from w ww . j av a 2 s . c om*/ builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { String result = (String) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "String"); if (result != null) { } } else { GWT.log("Result " + response.getStatusText(), null); } } } }); } catch (RequestException e) { GWT.log("Exception thrown: ", e); } } else { ModuleInterfaceAsync service = null; try { service = ((ModuleInterfaceAsync) Util .getProxy("org.freemedsoftware.gwt.client.Api.ModuleInterface")); } catch (Exception e) { } service.ModuleToTextMethod(moduleName, val, new AsyncCallback<String>() { public void onSuccess(String r) { searchBox.setText(r); } public void onFailure(Throwable t) { GWT.log("Exception", t); } }); } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterTemplateWidget.java
License:Open Source License
public void loadTemplates() { if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = {};/*from w w w.j a v a 2 s . c o m*/ RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.EncounterNotesTemplate.getTemplates", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { try { HashMap<String, String>[] r = (HashMap<String, String>[]) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (r != null) { if (r.length > 0) { templatesCustomTable.loadData(r); } else { } } else { } } catch (Exception e) { } } else { } } }); } catch (RequestException e) { } } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterTemplateWidget.java
License:Open Source License
public void getTemplateValues(String templateId) { reset();//from w ww . j ava 2 s . c o m tabPanel.selectTab(0); currentTemplate = templateId; if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { templateId }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util .getJsonRequest("org.freemedsoftware.module.EncounterNotesTemplate.getTemplateInfo", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { try { HashMap<String, String> r = (HashMap<String, String>) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>"); if (r != null) { templateValueMap = r; String secStr = r.get("pnotestsections"); HashMap<String, List<String>> secFldMap = (HashMap<String, List<String>>) JsonUtil .shoehornJson(JSONParser.parseStrict(secStr), "HashMap<String,List>"); tbEncTempName.setText(templateValueMap.get("pnotestname")); if (templateValueMap.get("pnotesttype") != null) { radType.setWidgetValue(templateValueMap.get("pnotesttype")); } templateWidget.loadValues(secFldMap); } else { } } catch (Exception e) { } } else { } } }); } catch (RequestException e) { } } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterTemplateWidget.java
License:Open Source License
public void deleteTemplate(String id) { if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { id }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.EncounterNotes.del", params))); try {/*from w w w .j ava 2s.c om*/ builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { try { Boolean r = (Boolean) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "Boolean"); if (r) { Util.showInfoMsg("EncounterNotesTemplate", "Encounter Note Template Successfully Deleted."); loadTemplates(); } } catch (Exception e) { } } else { } } }); } catch (RequestException e) { } } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterWidget.java
License:Open Source License
public void loadEOC() { if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { patientID }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL .encode(Util.getJsonRequest("org.freemedsoftware.module.EpisodeOfCare.getEOCValues", params))); try {/*from w w w . j a va 2s . co m*/ builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil .shoehornJson(JSONParser.parse(response.getText()), "HashMap<String,String>[]"); if (result != null) { if (result.length != 0) { for (int i = 0; i < result.length; i++) { HashMap<String, String> m = (HashMap<String, String>) result[i]; eocMap.put(m.get("Id"), m.get("eoc_info")); eocList.addItem(m.get("eoc_info"), m.get("Id")); } } else { } } } catch (Exception e) { } } } else { } } }); } catch (RequestException e) { } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterWidget.java
License:Open Source License
public void applyTemplate(String tid) { currTemplate = tid;/*from w w w . ja va2s .co m*/ if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { tid }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util .getJsonRequest("org.freemedsoftware.module.EncounterNotesTemplate.getTemplateInfo", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { try { HashMap<String, String> r = (HashMap<String, String>) JsonUtil.shoehornJson( JSONParser.parse(response.getText()), "HashMap<String,String>"); if (r != null) { templateValuesMap = r; String sectionsStr = r.get("pnotestsections"); sectionsFieldMap = (HashMap<String, List<String>>) JsonUtil .shoehornJson(JSONParser.parse(sectionsStr), "HashMap<String,List>"); for (int i = tabPanel.getWidgetCount() - 1; i >= 1; i--) { tabPanel.remove(i); } if (templateValuesMap.containsKey("pnotesttype") && templateValuesMap.get("pnotesttype") != null) { radType.setWidgetValue(templateValuesMap.get("pnotesttype")); } loadOtherTabs(); } else { } } catch (Exception e) { } } else { } } }); } catch (RequestException e) { } } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterWidget.java
License:Open Source License
public void loadCoverage(final int type, final CustomListBox clb) { if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { patientID, type + "" }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.PatientCoverages.GetCoverageByType", params))); try {/*from www . j a v a 2 s . c om*/ builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { if (Util.checkValidSessionResponse(response.getText())) { try { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil .shoehornJson(JSONParser.parse(response.getText()), "HashMap<String,String>[]"); if (result != null) { if (result.length != 0) { for (int i = 0; i < 1; i++) { HashMap<String, String> m = (HashMap<String, String>) result[i]; clb.addItem(m.get("comp_name"), m.get("Id")); } } else { } } } catch (Exception e) { } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterWidget.java
License:Open Source License
public void getBillAmount() { if (Util.getProgramMode() == ProgramMode.STUBBED) { // TODO: handle stubbed } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String selCov = "0"; if (listPrimCov != null && !listPrimCov.getStoredValue().equals("0")) { selCov = listPrimCov.getStoredValue(); } else if (listSecCov != null && !listSecCov.getStoredValue().equals("0")) { selCov = listSecCov.getStoredValue(); } else if (listTertCov != null && !listTertCov.getStoredValue().equals("0")) { selCov = listTertCov.getStoredValue(); } else if (listWorkCov != null && !listWorkCov.getStoredValue().equals("0")) { selCov = listWorkCov.getStoredValue(); }/*from w w w. j a v a 2 s . c om*/ String selUnits = JsonUtil.jsonify(tbProcUnits.getText()); String selCode = JsonUtil.jsonify(procCodeWidget.getStoredValue()); String selPro = JsonUtil.jsonify(provWidget.getStoredValue()); String ptid = JsonUtil.jsonify(patientID); String[] params = { selCov, selUnits, selCode, selPro, ptid }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.ProcedureModule.CalculateCharge", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(com.google.gwt.http.client.Request request, Throwable ex) { GWT.log("Exception", ex); } @SuppressWarnings("unchecked") public void onResponseReceived(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response) { if (200 == response.getStatusCode()) { Float result = (Float) JsonUtil.shoehornJson(JSONParser.parse(response.getText()), "Float"); if (result != null) { createProcedure(result); } else { } } else { } } }); } catch (RequestException e) { GWT.log("Exception", e); } } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterWidget.java
License:Open Source License
public void createProcedure(final float cost) { HashMap<String, String> map = new HashMap<String, String>(); map.put((String) "procpatient", patientID); map.put((String) "procphysician", provWidget.getStoredValue()); if (mod1Widget != null && mod1Widget.getStoredValue() != null || !mod1Widget.getStoredValue().equals("")) map.put((String) "proccptmod", mod1Widget.getStoredValue()); if (mod2Widget != null && mod2Widget.getStoredValue() != null || !mod2Widget.getStoredValue().equals("")) map.put((String) "proccptmod2", mod2Widget.getStoredValue()); if (mod3Widget != null && mod3Widget.getStoredValue() != null || !mod3Widget.getStoredValue().equals("")) map.put((String) "proccptmod3", mod3Widget.getStoredValue()); if (diag1Widget != null && diag1Widget.getStoredValue() != null || !diag1Widget.getStoredValue().equals("")) map.put((String) "procdiag1", diag1Widget.getStoredValue()); if (diag2Widget != null && diag2Widget.getStoredValue() != null || !diag2Widget.getStoredValue().equals("")) map.put((String) "procdiag2", diag2Widget.getStoredValue()); if (diag3Widget != null && diag3Widget.getStoredValue() != null || !diag3Widget.getStoredValue().equals("")) map.put((String) "procdiag3", diag3Widget.getStoredValue()); if (diag4Widget != null && diag4Widget.getStoredValue() != null || !diag4Widget.getStoredValue().equals("")) map.put((String) "procdiag4", diag4Widget.getStoredValue()); if (date.getTextBox().getText() != null || !date.getTextBox().getText().equals("")) map.put((String) "procdt", date.getTextBox().getText()); if (procCodeWidget.getStoredValue() != null || !procCodeWidget.getStoredValue().equals("")) map.put((String) "proccpt", procCodeWidget.getStoredValue()); if (tbProcUnits != null && tbProcUnits.getText() != null || !tbProcUnits.getText().equals("")) map.put((String) "procunits", tbProcUnits.getText()); if (posWidget.getStoredValue() != null || !posWidget.getStoredValue().equals("")) map.put((String) "procpos", posWidget.getStoredValue()); if (listAuthorizations.getSelectedIndex() != 0) map.put((String) "procauth", listAuthorizations.getValue(listAuthorizations.getSelectedIndex())); String coverageId = ""; String coverageType = ""; if (listWorkCov != null && !listWorkCov.getStoredValue().equals("0")) { coverageType = "4"; map.put((String) "proccov4", listWorkCov.getStoredValue()); coverageId = listWorkCov.getStoredValue(); }/*w w w. ja va 2 s . com*/ if (listTertCov != null && !listTertCov.getStoredValue().equals("0")) { coverageType = "3"; map.put((String) "proccov3", listTertCov.getStoredValue()); coverageId = listTertCov.getStoredValue(); } if (listSecCov != null && !listSecCov.getStoredValue().equals("0")) { coverageType = "2"; map.put((String) "proccov2", listSecCov.getStoredValue()); coverageId = listSecCov.getStoredValue(); } if (listPrimCov != null && !listPrimCov.getStoredValue().equals("0")) { coverageType = "1"; map.put((String) "proccov1", listPrimCov.getStoredValue()); coverageId = listPrimCov.getStoredValue(); } if (!coverageId.equals("")) map.put((String) "proccurcovid", coverageId); if (!coverageType.equals("")) map.put((String) "proccurcovtp", coverageType); map.put((String) "procbillable", "1"); map.put((String) "proccharges", "" + cost); map.put((String) "procbalorig", "" + cost); map.put((String) "procbalcurrent", "" + cost); String[] params = { JsonUtil.jsonify(map) }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest("org.freemedsoftware.module.ProcedureModule.add", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Integer result = (Integer) JsonUtil.shoehornJson(JSONParser.parse(response.getText()), "Integer"); if (result != null && result > 0) { callback.jsonifiedData(EncounterCommandType.UPDATE); } } else { Util.showErrorMsg("ProcedureModule", "Procedure creation failed."); } } }); } catch (RequestException e) { } }
From source file:org.freemedsoftware.gwt.client.widget.EncounterWidget.java
License:Open Source License
public void loadTemplates() { if (Util.getProgramMode() == ProgramMode.JSONRPC) { RequestBuilder builder = null;//www. ja v a2 s.co m if (radType.getWidgetValue() == null) { String[] params = {}; builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util .getJsonRequest("org.freemedsoftware.module.EncounterNotesTemplate.getTemplates", params))); } else { String[] params = { radType.getWidgetValue() }; builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util .getJsonRequest("org.freemedsoftware.module.EncounterNotesTemplate.getTemplates", params))); } try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { } @SuppressWarnings("unchecked") public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { try { HashMap<String, String>[] r = (HashMap<String, String>[]) JsonUtil.shoehornJson( JSONParser.parse(response.getText()), "HashMap<String,String>[]"); if (r != null) { if (r.length > 0) { templateTable.loadData(r); } else { } } else { } } catch (Exception e) { } } else { } } }); } catch (RequestException e) { } } }