Skip to content

Commit

Permalink
Merge pull request #362 from mozzy11/fix_bug2
Browse files Browse the repository at this point in the history
Add a selector for ward/dept/unit on batch order entry
  • Loading branch information
CalebSLane authored Jul 8, 2022
2 parents 9e281d3 + 283b63d commit d21e47a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ jQuery(document).ready(function () {
</td>
</tr>
</c:if>
<c:if test='${not empty form.sampleOrderItems.referringSiteDepartmentId}'>
<tr>
<td>
<spring:message code="sample.entry.project.siteDepartmentName" />
: <%= request.getAttribute("departmentName") %>
<form:hidden path="sampleOrderItems.referringSiteDepartmentId" id="requesterDepartmentId"/>
</td>
</tr>
</c:if>
<c:if test='${empty form.facilityID}'>
<c:if test='${not empty form.sampleOrderItems.newRequesterName}'>
<tr>
Expand All @@ -228,6 +237,15 @@ jQuery(document).ready(function () {
</tr>
</c:if>
</c:if>
<c:if test='${empty form.sampleOrderItems.referringSiteDepartmentId}'>
<tr>
<td>
<spring:message code="sample.entry.project.siteDepartmentName" />
: <%= request.getAttribute("departmentName") %>
<form:hidden path="sampleOrderItems.referringSiteDepartmentId" id="requesterDepartmentId"/>
</td>
</tr>
</c:if>
</tr>
</table>
</td>
Expand Down
57 changes: 57 additions & 0 deletions src/main/webapp/pages/samplebatchentry/setup/configureBarcode.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
</script>
<form:hidden path="sampleOrderItems.newRequesterName" id="newRequesterName"/>

Expand Down Expand Up @@ -131,6 +172,22 @@ Barcode Method :
<form:input path="facilityID" id="requesterId"/>
</c:if>
</td>
</tr>
<tr>
<c:if test="${not form.sampleOrderItems.readOnly}">
<td></td>
<td></td>
<td>
<spring:message code="sample.entry.project.siteDepartmentName"/>
</td>
<td>
<form:select path="sampleOrderItems.referringSiteDepartmentId"
id="requesterDepartmentId" >
<option ></option>
<form:options items="${form.sampleOrderItems.referringSiteDepartmentList}" itemValue="id" itemLabel="value"/>
</form:select>
</td>
</c:if>
</tr>
<tr>
<td></td>
Expand Down

0 comments on commit d21e47a

Please sign in to comment.