r5295 - branches/bmas-staging/ui/gwt/src/org/freemedsoftware/gwt/client/screen/patient

0 views
Skip to first unread message

subve...@svn.freemedsoftware.org

unread,
Mar 12, 2010, 2:01:21 PM3/12/10
to freemed-d...@googlegroups.com
Author: jeff
Date: 2010-03-12 14:01:21 -0500 (Fri, 12 Mar 2010)
New Revision: 5295

Modified:
branches/bmas-staging/ui/gwt/src/org/freemedsoftware/gwt/client/screen/patient/ToxicologyScreeningRecords.java
Log:
* printToxicologyLabel() needed to be called, not printDosingLabel()


Modified: branches/bmas-staging/ui/gwt/src/org/freemedsoftware/gwt/client/screen/patient/ToxicologyScreeningRecords.java
===================================================================
--- branches/bmas-staging/ui/gwt/src/org/freemedsoftware/gwt/client/screen/patient/ToxicologyScreeningRecords.java 2010-03-12 17:16:27 UTC (rev 5294)
+++ branches/bmas-staging/ui/gwt/src/org/freemedsoftware/gwt/client/screen/patient/ToxicologyScreeningRecords.java 2010-03-12 19:01:21 UTC (rev 5295)
@@ -1,3 +1,27 @@
+/*
+ * $Id$
+ *
+ * Authors:
+ * Jeff Buchbinder <je...@freemedsoftware.org>
+ *
+ * FreeMED Electronic Medical Record and Practice Management System
+ * Copyright (C) 1999-2010 FreeMED Software Foundation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
package org.freemedsoftware.gwt.client.screen.patient;

import java.util.Date;
@@ -7,6 +31,7 @@
import org.freemedsoftware.gwt.client.PatientEntryScreenInterface;
import org.freemedsoftware.gwt.client.Util;
import org.freemedsoftware.gwt.client.Util.ProgramMode;
+import org.freemedsoftware.gwt.client.screen.PatientScreen;
import org.freemedsoftware.gwt.client.widget.CustomDatePicker;
import org.freemedsoftware.gwt.client.widget.CustomRadioButtonGroup;
import org.freemedsoftware.gwt.client.widget.CustomTable;
@@ -32,72 +57,85 @@
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

-public class ToxicologyScreeningRecords extends PatientEntryScreenInterface{
+public class ToxicologyScreeningRecords extends PatientEntryScreenInterface {
protected VerticalPanel verticalPanel;
- protected CustomDatePicker startDate,endDate;
+ protected CustomDatePicker startDate, endDate;
protected FlexTable timePeriodFlexTable;
protected Button btnViewRecords;
protected CustomTable screeningRecordsTable;
protected CustomRadioButtonGroup dosingStationRadioButtons;
protected Popup printingStation;
protected HashMap<String, String> dosingStationLookup = new HashMap<String, String>();
- protected String currDate,currPanel,currAdditionalTests,currCounsler;
+ protected String currDate, currPanel, currAdditionalTests, currCounsler;
protected int currID;
- protected final String IMAGE_PRINT = "resources/images/ico.printer.16x16.png";
- public ToxicologyScreeningRecords(){
+ protected final String IMAGE_PRINT = "resources/images/ico.printer.16x16.png";
+
+ public ToxicologyScreeningRecords() {
verticalPanel = new VerticalPanel();
verticalPanel.setSpacing(10);
initWidget(verticalPanel);
- Label lbStartDate=new Label("Start Date");
- Label lbEndDate=new Label("End Date");
- startDate=new CustomDatePicker();
- endDate=new CustomDatePicker();
+ Label lbStartDate = new Label("Start Date");
+ Label lbEndDate = new Label("End Date");
+ startDate = new CustomDatePicker();
+ endDate = new CustomDatePicker();
endDate.setValue(new Date());
- btnViewRecords=new Button("View Records");
- btnViewRecords.addClickHandler(new ClickHandler(){
+ btnViewRecords = new Button("View Records");
+ btnViewRecords.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
populateScreeningRecordTable();
}
-
});
- timePeriodFlexTable=new FlexTable();
+ timePeriodFlexTable = new FlexTable();
timePeriodFlexTable.setWidget(0, 0, lbStartDate);
timePeriodFlexTable.setWidget(0, 1, startDate);
timePeriodFlexTable.setWidget(1, 0, lbEndDate);
timePeriodFlexTable.setWidget(1, 1, endDate);
-
+
verticalPanel.add(timePeriodFlexTable);
verticalPanel.add(btnViewRecords);
verticalPanel.add(createDoseTable());
-
- dosingStationRadioButtons = new CustomRadioButtonGroup("allOpenDoseingStation");
+
+ dosingStationRadioButtons = new CustomRadioButtonGroup(
+ "allOpenDoseingStation");
populateDosingStation();
-
+
}
-
- public void populateScreeningRecordTable()
- {
+
+ public void populateScreeningRecordTable() {
if (Util.getProgramMode() == ProgramMode.STUBBED) {
// TODO: handle stubbed
} else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
-
- String[] params = {JsonUtil.jsonify(patientScreen.getPatient().toString()),startDate
- .getTextBox().getText(),endDate.getTextBox().getText()};
-
- RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,URL.encode(Util.getJsonRequest("org.freemedsoftware.module.ScheduledTestRecord.getRecords",params)));
-
+ String[] params = {
+ JsonUtil.jsonify(PatientScreen.getPatient().toString()),
+ startDate.getTextBox().getText(),
+ endDate.getTextBox().getText() };
+
+ RequestBuilder builder = new RequestBuilder(
+ RequestBuilder.POST,
+ URL
+ .encode(Util
+ .getJsonRequest(
+ "org.freemedsoftware.module.ScheduledTestRecord.getRecords",
+ params)));
+
try {
builder.sendRequest(null, new RequestCallback() {
- public void onError(com.google.gwt.http.client.Request request,Throwable ex) {
+ 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()) {
- HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil.shoehornJson(JSONParser.parse(response.getText()),"HashMap<String,String>[]");
+ HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil
+ .shoehornJson(JSONParser.parse(response
+ .getText()),
+ "HashMap<String,String>[]");
if (result != null) {
screeningRecordsTable.loadData(result);
} else {
@@ -110,9 +148,10 @@
GWT.log("Exception", e);
}
} else {
-
+
}
}
+
private CustomTable createDoseTable() {
screeningRecordsTable = new CustomTable();
screeningRecordsTable.setIndexName("Id");
@@ -123,52 +162,58 @@
screeningRecordsTable.addColumn("Test Panel", "panel");
screeningRecordsTable.addColumn("Additional Tests", "additional_test");
screeningRecordsTable.addColumn("Action", "action");
- screeningRecordsTable.setTableRowClickHandler(new TableRowClickHandler() {
- @Override
- public void handleRowClick(HashMap<String, String> data, int col) {
- try {
- if (col == 0) {
- /* doseAssignedDateTemp.setText(data.get("date").substring(6)); */
-
+ screeningRecordsTable
+ .setTableRowClickHandler(new TableRowClickHandler() {
+ @Override
+ public void handleRowClick(HashMap<String, String> data,
+ int col) {
+ try {
+ if (col == 0) {
+ /*
+ * doseAssignedDateTemp.setText(data.get("date").
+ * substring(6));
+ */
+
+ }
+ } catch (Exception e) {
+ GWT.log("Caught exception: ", e);
+ }
+
}
- } catch (Exception e) {
- GWT.log("Caught exception: ", e);
- }

- }
+ });

- });
-
- screeningRecordsTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
+ screeningRecordsTable
+ .setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
@Override
public Widget setColumn(String columnName,
final HashMap<String, String> data) {
if (columnName.compareTo("action") == 0) {
-
- HorizontalPanel actionPanel=new HorizontalPanel();
+
+ HorizontalPanel actionPanel = new HorizontalPanel();
Image printImage = new Image(IMAGE_PRINT);
printImage.setTitle("Print Label");
- printImage.addClickHandler(new ClickHandler()
- {
+ printImage.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- currDate=data.get("test_date");
- currPanel=data.get("panel");
- currAdditionalTests=data.get("additional_test");
- currCounsler=data.get("nurse");
- currID=Integer.parseInt(data.get("Id"));
- printingStation=new Popup();
+ currDate = data.get("test_date");
+ currPanel = data.get("panel");
+ currAdditionalTests = data
+ .get("additional_test");
+ currCounsler = data.get("nurse");
+ currID = Integer.parseInt(data.get("Id"));
+ printingStation = new Popup();
PopupView viewInfo = new PopupView(
createDosingStationSelectionPopup());
printingStation.setNewWidget(viewInfo);
printingStation.initialize();
}
});
-
- actionPanel.add(printImage);
+
+ actionPanel.add(printImage);
return actionPanel;
}
-
+
else {
return (Widget) null;
}
@@ -177,34 +222,34 @@
});
return screeningRecordsTable;
}
- private VerticalPanel createDosingStationSelectionPopup()
- {
+
+ private VerticalPanel createDosingStationSelectionPopup() {
Label printHeaderLabel = new Label("Select Station to Print Label");
printHeaderLabel.setStyleName("label");
-
+
Button printBtn = new Button("Print");
- //btsplit2.setWidth("100%");
+ // btsplit2.setWidth("100%");
printBtn.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
printingStation.hide();
changeTestStatus();
- printToicologyLabel();
+ printToxicologyLabel();
}
});
- VerticalPanel vp=new VerticalPanel();
+ VerticalPanel vp = new VerticalPanel();
vp.setSpacing(6);
vp.add(printHeaderLabel);
vp.add(dosingStationRadioButtons);
vp.add(printBtn);
-
+
return vp;
}
- private void changeTestStatus(){
+
+ private void changeTestStatus() {
if (Util.getProgramMode() == ProgramMode.JSONRPC) {

-
- String[] params = {""+currID,"1"};
+ String[] params = { "" + currID, "1" };
RequestBuilder builder = new RequestBuilder(
RequestBuilder.POST,
URL
@@ -217,7 +262,7 @@
public void onError(
com.google.gwt.http.client.Request request,
Throwable ex) {
- //Window.alert(ex.toString());
+ // Window.alert(ex.toString());
JsonUtil.debug(ex.toString());

}
@@ -230,11 +275,11 @@
if (Util.checkValidSessionResponse(response
.getText())) {
populateScreeningRecordTable();
-
+
}
} else {
JsonUtil.debug(response.toString());
- //Window.alert( );
+ // Window.alert( );
}
}
});
@@ -246,29 +291,31 @@
}

}
-
- private void printToicologyLabel(){
+
+ private void printToxicologyLabel() {
if (Util.getProgramMode() == ProgramMode.JSONRPC) {
- String dsid=dosingStationLookup.get(dosingStationRadioButtons.getWidgetValue()).toString();
- String patname=JsonUtil.jsonify(patientScreen.getPatientName());
- String proname=JsonUtil.jsonify(patientScreen.getProviderName());
- String pan=JsonUtil.jsonify(currPanel);
- String addTests=JsonUtil.jsonify(currAdditionalTests);
- //Window.alert("dsid:"+dsid+", pt name:"+patname+",pt id:"+patientId.toString()+",Pr Name:"+proname+",Exp Date:"+expiryDate+", Quantity:"+doseQuan+",Date:"+dDate+"Lot No:"+lotId);
- String[] params = {dsid,patname,patientId.toString(),proname,currCounsler,pan,currDate,addTests};
+ String dsid = dosingStationLookup.get(
+ dosingStationRadioButtons.getWidgetValue()).toString();
+ String patname = JsonUtil.jsonify(patientScreen.getPatientName());
+ String proname = JsonUtil.jsonify(patientScreen.getProviderName());
+ String pan = JsonUtil.jsonify(currPanel);
+ String addTests = JsonUtil.jsonify(currAdditionalTests);
+ // Window.alert("dsid:"+dsid+", pt name:"+patname+",pt id:"+patientId.toString()+",Pr Name:"+proname+",Exp Date:"+expiryDate+", Quantity:"+doseQuan+",Date:"+dDate+"Lot No:"+lotId);
+ String[] params = { dsid, patname, patientId.toString(), proname,
+ currCounsler, pan, currDate, addTests };
RequestBuilder builder = new RequestBuilder(
RequestBuilder.POST,
URL
.encode(Util
.getJsonRequest(
- "org.freemedsoftware.module.DosingStation.printDosingLabel",
+ "org.freemedsoftware.module.DosingStation.printToxicologyLabel",
params)));
try {
builder.sendRequest(null, new RequestCallback() {
public void onError(
com.google.gwt.http.client.Request request,
Throwable ex) {
- //Window.alert(ex.toString());
+ // Window.alert(ex.toString());
JsonUtil.debug(ex.toString());

}
@@ -280,12 +327,11 @@
if (200 == response.getStatusCode()) {
if (Util.checkValidSessionResponse(response
.getText())) {
-
-
+
}
} else {
JsonUtil.debug(response.toString());
- //Window.alert( );
+ // Window.alert( );
}
}
});
@@ -297,13 +343,19 @@
}

}
-
- private void populateDosingStation() {

+ private void populateDosingStation() {
+
if (Util.getProgramMode() == ProgramMode.JSONRPC) {
// ////////////////////
- String[] params = {"labelonly"};
- RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,URL.encode(Util.getJsonRequest("org.freemedsoftware.module.DosingStation.getStationsByType",params)));
+ String[] params = { "labelonly" };
+ RequestBuilder builder = new RequestBuilder(
+ RequestBuilder.POST,
+ URL
+ .encode(Util
+ .getJsonRequest(
+ "org.freemedsoftware.module.DosingStation.getStationsByType",
+ params)));
try {
builder.sendRequest(null, new RequestCallback() {
public void onError(
@@ -315,30 +367,53 @@

@SuppressWarnings("unchecked")
public void onResponseReceived(
- com.google.gwt.http.client.Request request,com.google.gwt.http.client.Response response) {
+ com.google.gwt.http.client.Request request,
+ com.google.gwt.http.client.Response response) {
if (200 == response.getStatusCode()) {
- if (Util.checkValidSessionResponse(response.getText())) {
+ if (Util.checkValidSessionResponse(response
+ .getText())) {
HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil
- .shoehornJson(JSONParser.parse(response
- .getText()),
- "HashMap<String,String>[]");
+ .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];
- dosingStationLookup.put(m.get("D_name")+ "["+ m.get("ds_location")+"]", m.get("Id"));
-
- if(i==0)
- {
- dosingStationRadioButtons.addItem(m.get("D_name")+ "["+ m.get("ds_location")+"]");
- // dosingStationRadioButtons.addItem(m.get("D_name")+"["+m.get("ds_location")+"]");
- dosingStationRadioButtons.setWidgetValue(m.get("D_name")+ "["+ m.get("ds_location")+"]");
+ dosingStationLookup.put(m
+ .get("D_name")
+ + "["
+ + m.get("ds_location")
+ + "]", m.get("Id"));
+
+ if (i == 0) {
+ dosingStationRadioButtons
+ .addItem(m
+ .get("D_name")
+ + "["
+ + m
+ .get("ds_location")
+ + "]");
+ // dosingStationRadioButtons.addItem(m.get("D_name")+"["+m.get("ds_location")+"]");
+ dosingStationRadioButtons
+ .setWidgetValue(m
+ .get("D_name")
+ + "["
+ + m
+ .get("ds_location")
+ + "]");
} else {
- dosingStationRadioButtons.addItem(m.get("D_name")+ "["+ m.get("ds_location")+"]");
+ dosingStationRadioButtons
+ .addItem(m
+ .get("D_name")
+ + "["
+ + m
+ .get("ds_location")
+ + "]");
}
}
- } else {
-
+ } else {
+
}
}
}
@@ -353,8 +428,6 @@
// ///////////////////////////
} else {
}
-
-
-
+
}
}

Reply all
Reply to author
Forward
0 new messages