List of usage examples for com.google.gwt.http.client URL encode
public static String encode(String decodedURL)
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 v a 2s . 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 < 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;/*w w w .j a v a2 s. c o 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 {//ww w .ja va 2 s . 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 < 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 www . jav a2s. co m*/ 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(); }// ww w . jav a2 s . co m 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;/*from www .j a va2s .c om*/ 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) { } } }
From source file:org.freemedsoftware.gwt.client.widget.FinancialWidget.java
License:Open Source License
public void loadProcedureTableData() { procedureViewTable.clearData();/*from w ww .j a va 2s. c o m*/ if (Util.getProgramMode() == ProgramMode.STUBBED) { } else if (Util.getProgramMode() == ProgramMode.JSONRPC) { String[] params = { patientId.toString() }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.ProcedureModule.getProcedureInfo", params))); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable ex) { Window.alert(ex.toString()); } public void onResponseReceived(Request request, Response response) { if (Util.checkValidSessionResponse(response.getText())) { if (200 == response.getStatusCode()) { @SuppressWarnings("unchecked") HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); procedureViewTable.loadData(result); } else { } } } }); } catch (RequestException e) { Window.alert(e.toString()); procedureViewTable.setVisible(true); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.LedgerWidget.java
License:Open Source License
public void loadInsuranceList(final CustomListBox insList) { if (Util.getProgramMode() == ProgramMode.JSONRPC) { // //////////////////// String[] params = { procId }; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode( Util.getJsonRequest("org.freemedsoftware.module.ProcedureModule.getCoverages", params))); try {//from w ww.j av a 2 s.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.parseStrict(response.getText()), "HashMap<String,String>[]"); if (result != null) { if (result.length != 0) { hasInsurance = true; for (int i = 0; i < result.length; i++) { insList.addItem(result[i].get("payer"), result[i].get("id")); } } else { } } else { paymentTypeGroup.customRadioButtonGroup.get(1).setEnabled(false); paymentTypeGroup.customRadioButtonGroup.get(2).setEnabled(false); } } catch (Exception e) { //Window.alert(e.getMessage()); //paymentTypeGroup.customRadioButtonGroup.get(2).setEnabled(false); } } } else { } } }); } catch (RequestException e) { Window.alert(e.toString()); } } else { } }
From source file:org.freemedsoftware.gwt.client.widget.LedgerWidget.java
License:Open Source License
private void processPayment() { JsonUtil.debug("before saving"); final LedgerWidget lw = this; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest(functionName, params))); try {//from w w w. ja v a 2 s . com 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 result = (Boolean) JsonUtil .shoehornJson(JSONParser.parseStrict(response.getText()), "Boolean"); if (result) { Util.showInfoMsg("Ledger", _("Payment operation succeeded.")); lw.removeFromParent(); if (paycat == PayCategory.PAYMENT || paycat == PayCategory.COPAY || paycat == PayCategory.DEDUCTABLE) { if (CurrentState.getSystemConfig("auto_print_ptrcpt").equals("1")) { printShortPatientReceipt(); } } if ((paycat == PayCategory.REBILLED || paycat == PayCategory.WRITEOFF) && !procId.equals("0")) { callback.jsonifiedData("close"); } else { callback.jsonifiedData("update"); } } else { Util.showErrorMsg("Ledger", _("Payment operation failed.")); } } catch (Exception e) { Util.showErrorMsg("Ledger", _("Payment operation failed.")); } } else { Util.showErrorMsg("Ledger", _("Payment operation failed.")); } } }); } catch (RequestException e) { } }
From source file:org.freemedsoftware.gwt.client.widget.LedgerWidget.java
License:Open Source License
private void getLedgerInfo() { final LedgerWidget lw = this; RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(Util.getJsonRequest(functionName, params))); try {//from w ww . j a va 2s. c o m 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()) { HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil.shoehornJson( JSONParser.parseStrict(response.getText()), "HashMap<String,String>[]"); if (result.length > 0) { for (int i = 0; i < result.length; i++) { int row = ledgerInfoFlexTable.getRowCount(); if (i != (result.length - 1)) { ledgerInfoFlexTable.setText(row, 0, result[i].get("date")); ledgerInfoFlexTable.setText(row, 1, result[i].get("type")); ledgerInfoFlexTable.setText(row, 2, result[i].get("desc")); ledgerInfoFlexTable.setText(row, 3, result[i].get("charge")); ledgerInfoFlexTable.setText(row, 4, result[i].get("payment")); ledgerInfoFlexTable.setText(row, 5, ""); if ((i % 2) == 0) { RowFormatter rowFormatter = ledgerInfoFlexTable.getRowFormatter(); rowFormatter.setStyleName(row, AppConstants.STYLE_TABLE_ROW); } else { RowFormatter rowFormatter = ledgerInfoFlexTable.getRowFormatter(); rowFormatter.setStyleName(row, AppConstants.STYLE_TABLE_ROW_ALTERNATE); } } else { ledgerInfoFlexTable.setText(row, 0, _("Total")); ledgerInfoFlexTable.setText(row, 3, result[i].get("total_charges")); ledgerInfoFlexTable.setText(row, 4, result[i].get("total_payments")); int charges = new Integer(result[i].get("total_charges")); int payments = new Integer(result[i].get("total_payments")); ledgerInfoFlexTable.setText(row, 5, "" + (charges - payments)); RowFormatter rowFormatter = ledgerInfoFlexTable.getRowFormatter(); rowFormatter.setStyleName(row, AppConstants.STYLE_TABLE_HEADER); } } } else { } } else { } } }); } catch (RequestException e) { } }