Skip to content

Commit

Permalink
added drugConceptId check
Browse files Browse the repository at this point in the history
  • Loading branch information
merovingienne committed Aug 25, 2017
1 parent ec0373a commit 0cedcea
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
Expand Up @@ -97,11 +97,21 @@ public FragmentActionResult addTheaterDrugPrescription(UiUtils ui,
return new FailureResult(ui.message("Wrong surgery workflow position."));
}

if (drugConceptId == null || drugConceptId.length() == 0 || drugConceptId == "undefined"){
return new FailureResult(ui.message("Invalid drug."));
}

ConceptService conceptService = Context.getConceptService();
ObsService obsService = Context.getObsService();

Concept drug = null;


Concept drug = conceptService.getConcept(Integer.parseInt(drugConceptId));
try {
drug = conceptService.getConcept(Integer.parseInt(drugConceptId));
} catch (NumberFormatException e) {
return new FailureResult(ui.message("Invalid drug."));
}

Obs surgeryInfoObs = SurgeryObsUtil.getSurgeryObs(surgery, patient);

Expand Down
Expand Up @@ -213,8 +213,8 @@ public FragmentActionResult addPretheaterDrugPrescription(UiUtils ui,
return new FailureResult(ui.message("operationtheater.patient.notFound"));
}

if (drugConceptId == null || drugConceptId.length() == 0){
return new FailureResult(ui.message("Drug not found."));
if (drugConceptId == null || drugConceptId.length() == 0 || drugConceptId == "undefined"){
return new FailureResult(ui.message("Invalid drug."));
}

if (drugQuantity == null || drugQuantity.length() == 0){
Expand All @@ -226,7 +226,13 @@ public FragmentActionResult addPretheaterDrugPrescription(UiUtils ui,
ObsService obsService = Context.getObsService();


Concept drug = conceptService.getConcept(Integer.parseInt(drugConceptId));
Concept drug = null;

try {
drug = conceptService.getConcept(Integer.parseInt(drugConceptId));
} catch (NumberFormatException e) {
return new FailureResult(ui.message("Invalid drug."));
}

Obs surgeryInfoObs = SurgeryObsUtil.getSurgeryObs(surgery, patient);

Expand Down
17 changes: 17 additions & 0 deletions omod/src/main/webapp/pages/surgery.gsp
Expand Up @@ -7,6 +7,7 @@
ui.includeJavascript("operationtheater", "preTheaterForm_page/pastProcedures.js")
ui.includeJavascript("operationtheater", "preTheaterForm_page/drugs.js")
ui.includeJavascript("operationtheater", "postTheaterForm_page/drugs.js")
ui.includeJavascript("operationtheater", "postTheaterForm_page/surgeryNote.js")
ui.includeJavascript("uicommons", "emr.js")
ui.includeJavascript("uicommons", "typeahead.js");
Expand Down Expand Up @@ -327,6 +328,22 @@ fieldset {
${ ui.includeFragment('operationtheater', 'postTheaterDrugs',[
includeForm: false,
])}

<br>
<div class="section-item">
<h3>Surgery notes</h3>
<div id="surgery-note-div">
<table id="surgery-note-table" style="margin: 10px 0px">
<tbody id="surgery-note-table-body">

</tbody>

</table>
</div>
</div>



<% } %>


Expand Down

0 comments on commit 0cedcea

Please sign in to comment.