diff --git a/src/main/java/org/openelisglobal/samplebatchentry/controller/SampleBatchEntryController.java b/src/main/java/org/openelisglobal/samplebatchentry/controller/SampleBatchEntryController.java index 1d473db097..8764572a0a 100644 --- a/src/main/java/org/openelisglobal/samplebatchentry/controller/SampleBatchEntryController.java +++ b/src/main/java/org/openelisglobal/samplebatchentry/controller/SampleBatchEntryController.java @@ -65,7 +65,7 @@ public class SampleBatchEntryController extends BaseController { // "sampleOrderItems.labNo", // - "sampleOrderItems.newRequesterName", "sampleOrderItems.referringSiteId", + "sampleOrderItems.newRequesterName", "sampleOrderItems.referringSiteId", "sampleOrderItems.referringSiteDepartmentId" , "form.sampleOrderItems.referringSiteName", "patientProperties.patientUpdateStatus", "currentDate", "currentTime", "sampleOrderItems.receivedDateForDisplay", "sampleOrderItems.receivedTime", "sampleXML", "sampleOrderItems.referringSiteId", "sampleOrderItems.referringSiteId", @@ -112,6 +112,8 @@ public ModelAndView showSampleBatchEntry(HttpServletRequest request, soi.setReceivedDateForDisplay(form.getSampleOrderItems().getReceivedDateForDisplay()); soi.setNewRequesterName(form.getSampleOrderItems().getNewRequesterName()); soi.setReferringSiteId(form.getFacilityID()); + soi.setReferringSiteDepartmentId(form.getSampleOrderItems().getReferringSiteDepartmentId()); + form.setSampleOrderItems(soi); form.setLocalDBOnly(ConfigurationProperties.getInstance() @@ -147,7 +149,13 @@ public ModelAndView showSampleBatchEntry(HttpServletRequest request, } else if (!StringUtil.isNullorNill(form.getSampleOrderItems().getNewRequesterName())) { facilityName = form.getSampleOrderItems().getNewRequesterName(); } + String departmentName = ""; + if (!StringUtil.isNullorNill(form.getSampleOrderItems().getReferringSiteDepartmentId())) { + Organization organization = organizationService.get(form.getSampleOrderItems().getReferringSiteDepartmentId()); + departmentName = organization.getOrganizationName(); + } request.setAttribute("facilityName", facilityName); + request.setAttribute("departmentName", departmentName); form.setPatientSearch(new PatientSearch()); return findForward(form.getMethod(), form); diff --git a/src/main/webapp/pages/samplebatchentry/routine/sampleBatchEntry.jsp b/src/main/webapp/pages/samplebatchentry/routine/sampleBatchEntry.jsp index c4e6726414..9d4d13bafa 100644 --- a/src/main/webapp/pages/samplebatchentry/routine/sampleBatchEntry.jsp +++ b/src/main/webapp/pages/samplebatchentry/routine/sampleBatchEntry.jsp @@ -217,6 +217,15 @@ jQuery(document).ready(function () { + + + + + : <%= request.getAttribute("departmentName") %> + + + + @@ -228,6 +237,15 @@ jQuery(document).ready(function () { + + + + + : <%= request.getAttribute("departmentName") %> + + + + diff --git a/src/main/webapp/pages/samplebatchentry/setup/configureBarcode.jsp b/src/main/webapp/pages/samplebatchentry/setup/configureBarcode.jsp index cdb8fa29a4..b5a1351772 100644 --- a/src/main/webapp/pages/samplebatchentry/setup/configureBarcode.jsp +++ b/src/main/webapp/pages/samplebatchentry/setup/configureBarcode.jsp @@ -90,8 +90,49 @@ jQuery(document).ready(function () { // setOrderModified(); //setCorrectSave(); }; + + autocompleteResultCallBack = function (selectId, value) { + fetchDepartmentList(); + } }); + function fetchDepartmentList() { + var siteList = $("requesterId"); + //if the index is 0 it is a new entry, if it is not then the textValue may include the index value + // create new entry has been removed gnr + if (siteList.selectedIndex != 0) { + if(document.getElementById("requesterId").selectedIndex != 0){ + getDepartmentsForSiteClinic( document.getElementById("requesterId").value, "", siteDepartmentSuccess, null); + } + } + } + + function siteDepartmentSuccess (xhr) { + console.log(xhr.responseText); + var message = xhr.responseXML.getElementsByTagName("message").item(0).firstChild.nodeValue; + var departments = xhr.responseXML.getElementsByTagName("formfield").item(0).childNodes[0].childNodes; + var selected = xhr.responseXML.getElementsByTagName("formfield").item(0).childNodes[1]; + var isValid = message == "<%=IActionConstants.VALID%>"; + var requesterDepartment = jQuery("#requesterDepartmentId"); + var i = 0; + + requesterDepartment.disabled = ""; + if( isValid ){ + requesterDepartment.children('option').remove(); + requesterDepartment.append(new Option('', '')); + for( ;i < departments.length; ++i){ +// is this supposed to be value value or value id? + requesterDepartment.append( + new Option(departments[i].attributes.getNamedItem("value").value, + departments[i].attributes.getNamedItem("id").value)); + } + } + + if( selected){ + requesterDepartment.selectedIndex = getSelectIndexFor( "requesterDepartmentId", selected.childNodes[0].nodeValue); + } + } + @@ -131,6 +172,22 @@ Barcode Method : + + + + + + + + + + + + + + +