Skip to content

Commit

Permalink
Merge pull request #567 from abertnamanya/whonet
Browse files Browse the repository at this point in the history
Added antimicrobialResistance column to test table
  • Loading branch information
mozzy11 authored Oct 20, 2023
2 parents 88a0229 + 865ef1f commit 0e7e5c5
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 10 deletions.
10 changes: 10 additions & 0 deletions src/main/java/org/openelisglobal/test/valueholder/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public class Test extends EnumValueItemImpl {
// should we notify patient of a finalized result
private Boolean notifyResults;

private Boolean antimicrobialResistance;

@Override
public String getSortOrder() {
return sortOrder;
Expand Down Expand Up @@ -506,6 +508,14 @@ public void setInLabOnly(boolean inLabOnly) {
this.inLabOnly = inLabOnly;
}

public void setAntimicrobialResistance(Boolean antimicrobialResistance) {
this.antimicrobialResistance = antimicrobialResistance;
}

public Boolean getAntimicrobialResistance() {
return antimicrobialResistance;
}

@Override
public boolean equals(Object o) {
if (this == o)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class TestCatalogBean {
private List<ResultLimitBean> resultLimits;
private int testSortOrder = Integer.MAX_VALUE;
private boolean inLabOnly;
private boolean antimicrobialResistance;

public String getId() {
return id;
Expand Down Expand Up @@ -219,4 +220,12 @@ public Boolean getInLabOnly() {
public void setInLabOnly(boolean inLabOnly) {
this.inLabOnly = inLabOnly;
}

public boolean getAntimicrobialResistance() {
return antimicrobialResistance;
}

public void setAntimicrobialResistance(boolean antimicrobialResistance) {
this.antimicrobialResistance = antimicrobialResistance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ private List<TestSet> createTestSets(TestAddParams testAddParams) {
test.setOrderable("Y".equals(testAddParams.orderable));
test.setNotifyResults("Y".equals(testAddParams.notifyResults));
test.setInLabOnly("Y".equals(testAddParams.inLabOnly));
test.setAntimicrobialResistance("Y".equals(testAddParams.antimicrobialResistance));
test.setIsReportable("N");
test.setTestSection(testSection);
test.setGuid(String.valueOf(UUID.randomUUID()));
Expand Down Expand Up @@ -362,6 +363,7 @@ private TestAddParams extractTestAddParms(JSONObject obj, JSONParser parser) {
testAddParams.orderable = (String) obj.get("orderable");
testAddParams.notifyResults = (String) obj.get("notifyResults");
testAddParams.inLabOnly = (String) obj.get("inLabOnly");
testAddParams.antimicrobialResistance = (String) obj.get("antimicrobialResistance");
if (TypeOfTestResultServiceImpl.ResultType.isNumericById(testAddParams.resultTypeId)) {
testAddParams.lowValid = (String) obj.get("lowValid");
testAddParams.highValid = (String) obj.get("highValid");
Expand Down Expand Up @@ -564,6 +566,7 @@ public class TestAddParams {
String orderable;
String notifyResults;
String inLabOnly;
String antimicrobialResistance;
String lowValid;
String highValid;
String lowReportingRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private List<TestCatalogBean> createTestCatBeanList() {
bean.setOrderable(test.getOrderable() ? "Orderable" : "Not orderable");
bean.setNotifyResults(test.isNotifyResults());
bean.setInLabOnly(test.isInLabOnly());
bean.setAntimicrobialResistance(test.getAntimicrobialResistance());
bean.setLoinc(test.getLoinc());
bean.setActive(test.isActive() ? "Active" : "Not active");
bean.setUom(testService.getUOM(test, false));
Expand Down Expand Up @@ -564,6 +565,7 @@ private List<TestSet> createTestSets(TestAddParams testAddParams) {
test.setOrderable("Y".equals(testAddParams.orderable));
test.setNotifyResults("Y".equals(testAddParams.notifyResults));
test.setInLabOnly("Y".equals(testAddParams.inLabOnly));
test.setAntimicrobialResistance("Y".equals(testAddParams.antimicrobialResistance));
test.setIsReportable("N");
test.setTestSection(testSection);
if (GenericValidator.isBlankOrNull(test.getGuid())) {
Expand Down Expand Up @@ -666,6 +668,7 @@ private TestAddParams extractTestAddParms(JSONObject obj, JSONParser parser) {
testAddParams.orderable = (String) obj.get("orderable");
testAddParams.notifyResults = (String) obj.get("notifyResults");
testAddParams.inLabOnly = (String) obj.get("inLabOnly");
testAddParams.antimicrobialResistance = (String) obj.get("antimicrobialResistance");
if (TypeOfTestResultServiceImpl.ResultType.isNumericById(testAddParams.resultTypeId)) {
testAddParams.lowValid = (String) obj.get("lowValid");
testAddParams.highValid = (String) obj.get("highValid");
Expand Down Expand Up @@ -796,6 +799,7 @@ public class TestAddParams {
String orderable;
public String notifyResults;
public String inLabOnly;
public String antimicrobialResistance;
String lowValid;
String highValid;
String lowReportingRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void updateTestSets(List<TestSet> testSets, TestAddParams testAddParams,

updateTestNames(testAddParams.testId, nameLocalization, reportingNameLocalization, currentUserId);
updateTestEntities(testAddParams.testId, testAddParams.loinc, currentUserId, testAddParams.uomId,
testAddParams.testSectionId, set.test.isNotifyResults(), set.test.isInLabOnly());
testAddParams.testSectionId, set.test.isNotifyResults(), set.test.isInLabOnly(), set.test.getAntimicrobialResistance());

set.sampleTypeTest.setSysUserId(currentUserId);
set.sampleTypeTest.setTestId(set.test.getId());
Expand Down Expand Up @@ -174,7 +174,7 @@ private void updateTestDefault(String testId, TestResult testResult, String curr
}

private void updateTestEntities(String testId, String loinc, String userId, String uomId, String testSectionId,
boolean notifyResults, boolean inLabOnly) {
boolean notifyResults, boolean inLabOnly, boolean antimicrobialResistance) {
Test test = testService.get(testId);
TestSection testSection = testSectionService.get(testSectionId);

Expand All @@ -184,6 +184,7 @@ private void updateTestEntities(String testId, String loinc, String userId, Stri
test.setUnitOfMeasure(unitOfMeasureService.getUnitOfMeasureById(uomId));
test.setNotifyResults(notifyResults);
test.setInLabOnly(inLabOnly);
test.setAntimicrobialResistance(antimicrobialResistance);
test.setTestSection(testSection);
testService.update(test);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public void validate(Object target, Errors errors) {
ValidationHelper.validateIdField(StringUtil.nullSafeToString(newTest.get("resultType")), "JsonWad",
"resultType", errors, true);

ValidationHelper.validateYNField(StringUtil.nullSafeToString(newTest.get("antimicrobialResistance")), "JsonWad",
"antimicrobialResistance", errors);

ValidationHelper.validateYNField(StringUtil.nullSafeToString(newTest.get("orderable")), "JsonWad",
"orderable", errors);

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/hibernate/hbm/Test.hbm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
</many-to-one>
<property name="inLabOnly" type="java.lang.Boolean"
column="in_lab_only" />

<property name="antimicrobialResistance" type="java.lang.Boolean"
column="antimicrobial_resistance" />
</class>
<!-- <query name="test.getNext"> -->
<!-- from Test t order by t.testSection.testSectionName, t.testName -->
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/languages/message_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,7 @@ electronic.order.message.suggestion = Try re-checking the order number or \
ellis.configuration = Configuration
ellis.login.user.name = ELIS Logon User
ellis.version = Version
referral.noreferralDisplayItem

emergency.contact = Emergency Contact

eorder.browse.title = View Electronic Orders
Expand Down Expand Up @@ -6781,6 +6781,7 @@ test.validation.total.percent = Hemat\
ology\
Total\
%
test.antimicrobialResistance = Antimicrobial Resistance

testSection.Biochemistry = Biochemistry
testSection.EID = Virology DNA PCR
Expand All @@ -6793,13 +6794,12 @@ testSection.VL = Virology Viral Load
testSection.Virology = Virology
testSection.testSectionName = Test Section Name

testUnit.existing = Existing Test Units
method.existing = Existing Methods

testUnit.existing.inactive = Inactive Test Units. Assign tests to activate.
method.existing.inactive = Inactive Methods. Assign tests to activate.
testUnit.new = New Unit Test
method.new = New Method
method.methodName = Method Name

method.browse.title = Method Section


Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/languages/message_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6770,6 +6770,8 @@ test.validation.total.percent = H\
matologie \
Totale %

test.antimicrobialResistance = Résistance aux antimicrobiens

testSection.Biochemistry = Biochimie
testSection.EID = Virologie DNA PCR
testSection.Hematology = H\u00E9matologie
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="abertnamanya" id="26092023-abertnamanya">
<preConditions onFail="MARK_RAN">
<tableExists tableName="test"/>
</preConditions>
<comment>Add Antimicrobial Resistance column to test table</comment>
<addColumn tableName="test">
<column name="antimicrobial_resistance" type="boolean" defaultValueBoolean="false"/>
</addColumn>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/liquibase/2.8.x.x/base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<include relativeToChangelogFile="true" file="immunohistochemistry.xml" />
<include relativeToChangelogFile="true" file="cytology.xml" />
<include relativeToChangelogFile="true" file="sample_types.xml" />
<include relativeToChangelogFile="true" file="add_antimicrobial_resistance_test_column.xml" />
</databaseChangeLog>
9 changes: 9 additions & 0 deletions src/main/webapp/pages/testConfiguration/testAdd.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@
jQuery("#orderableRO").text(jQuery("#orderable").attr("checked") ? "Y" : "N");
jQuery("#notifyResultsRO").text(jQuery("#notifyResults").attr("checked") ? "Y" : "N");
jQuery("#inLabOnlyRO").text(jQuery("#inLabOnly").attr("checked") ? "Y" : "N");
jQuery("#antimicrobialResistanceRO").text(jQuery("#antimicrobialResistance").attr("checked") ? "Y" : "N");
}
function createJSON() {
Expand All @@ -890,6 +891,7 @@
jsonObj.orderable = jQuery("#orderable").attr("checked") ? 'Y' : 'N';
jsonObj.notifyResults = jQuery("#notifyResults").attr("checked") ? 'Y' : 'N';
jsonObj.inLabOnly = jQuery("#inLabOnly").attr("checked") ? 'Y' : 'N';
jsonObj.antimicrobialResistance = jQuery("#antimicrobialResistance").attr("checked") ? 'Y' : 'N';
jsonObj.active = jQuery("#active").attr("checked") ? 'Y' : 'N';
jsonObj.sampleTypes = [];
addJsonSortingOrder(jsonObj);
Expand Down Expand Up @@ -1211,6 +1213,8 @@ td {
onchange="checkReadyForNextStep()" />
<br/>
<br/><br/>
<label for="antimicrobialResistance"><spring:message code="test.antimicrobialResistance"/></label>
<input type="checkbox" id="antimicrobialResistance" /><br/>
<label for="orderable"><spring:message code="test.isActive"/></label>
<input type="checkbox" id="active" checked="checked"/><br/>
<label for="orderable"><spring:message code="label.orderable"/></label>
Expand Down Expand Up @@ -1252,6 +1256,11 @@ td {
<spring:message code="result.resultType"/>
<div class="tab" id="resultTypeRO"></div>
<br/>

<spring:message code="test.antimicrobialResistance"/>
<div class="tab" id="antimicrobialResistanceRO"></div>
<br/>

<spring:message code="test.isActive"/>
<div class="tab" id="activeRO"></div>
<br/>
Expand Down
19 changes: 15 additions & 4 deletions src/main/webapp/pages/testConfiguration/testModify.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@
jQuery("#notifyResults").prop('checked', jQuery(elem).attr('fNotifyResults') === 'true');
jQuery("#inLabOnly").prop('checked', jQuery(elem).attr('fInLabOnly') === 'true');
jQuery("#antimicrobialResistance").prop('checked', jQuery(elem).attr('fantimicrobialResistance') === 'true');
jQuery("#panelSelection").change();
}
Expand Down Expand Up @@ -1514,6 +1515,7 @@
jQuery("#orderableRO").text(jQuery("#orderable").attr("checked") ? "Y" : "N");
jQuery("#notifyResultsRO").text(jQuery("#notifyResults").attr("checked") ? "Y" : "N");
jQuery("#inLabOnlyRO").text(jQuery("#inLabOnly").attr("checked") ? "Y" : "N");
jQuery("#antimicrobialResistanceRO").text(jQuery("#antimicrobialResistance").attr("checked") ? "Y" : "N");
}
function createJSON() {
Expand All @@ -1533,7 +1535,8 @@
jsonObj.notifyResults = jQuery("#notifyResults").attr("checked") ? 'Y' : 'N';
jsonObj.inLabOnly = jQuery("#inLabOnly").attr("checked") ? 'Y' : 'N';
jsonObj.active = jQuery("#active").attr("checked") ? 'Y' : 'N';
jsonObj.antimicrobialResistance = jQuery("#antimicrobialResistance").attr("checked") ? 'Y' : 'N';
jQuery(".resultClass").each(function (i,elem) {
jsonObj.testId = jQuery(elem).attr('fTestId');
console.log("createJSON: " + jQuery(elem).attr('fTestId') + ":" + jQuery(elem).attr('fResultType'));
Expand Down Expand Up @@ -1878,6 +1881,7 @@ td {
fReferenceId='<%=bean.getReferenceId()%>'
fNotifyResults='<%=bean.getNotifyResults()%>'
fInLabOnly='<%=bean.getInLabOnly()%>'
fantimicrobialResistance='<%=bean.getAntimicrobialResistance()%>'
class='resultClass'>

<tr>
Expand Down Expand Up @@ -1917,6 +1921,7 @@ td {
%>
<tr>
<td><b><%=bean.getActive()%></b></td>
<td><b><%=bean.getAntimicrobialResistance()%></b></td>
<td><b><%=bean.getOrderable()%></b></td>
<%if (bean.getNotifyResults()) { %><td><b><spring:message code="test.notifyResults"/></b></td><%} %>
<%if (bean.getInLabOnly()) { %><td><b><spring:message code="test.inLabOnly"/></b></td><%} %>
Expand Down Expand Up @@ -2187,8 +2192,10 @@ td {
<br />
<br />
<br />
<br />
<label for="orderable"><spring:message code="test.isActive" /></label>
<br />
<label for="antimicrobialResistance"><spring:message code="test.antimicrobialResistance"/></label>
<input type="checkbox" id="antimicrobialResistance" /><br/>
<label for="orderable"><spring:message code="test.isActive" /></label>
<input type="checkbox" id="active"checked="checked" /><br />
<label for="orderable"><spring:message code="label.orderable" /></label>
<input type="checkbox" id="orderable" checked="checked" /><br/>
Expand Down Expand Up @@ -2234,6 +2241,10 @@ td {
<spring:message code="result.resultType" />
<div class="tab" id="resultTypeRO"></div>
<br />

<spring:message code="test.antimicrobialResistance"/>
<div class="tab" id="antimicrobialResistanceRO"></div>
<br/>
<spring:message code="test.isActive" />
<div class="tab" id="activeRO"></div>
<br />
Expand Down

0 comments on commit 0e7e5c5

Please sign in to comment.