Skip to content

Commit

Permalink
Removed #726 & #557 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nehav39 committed Nov 18, 2019
1 parent 21f1717 commit c1e3d15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public class QuestionNodeActivity extends AppCompatActivity {
private String encounterVitals;
private String encounterAdultIntials;

private List<Node> optionsList = new ArrayList<>();
Node assoSympNode;
private JSONObject assoSympObj = new JSONObject();
private JSONArray assoSympArr = new JSONArray();
private JSONObject finalAssoSympObj = new JSONObject();

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -290,10 +285,6 @@ private void fabClick() {
complaintNumber++;
setupQuestions(complaintNumber);
complaintConfirmed = false;
} else if (complaints.size() > 1 && complaintNumber == complaints.size() - 1) {
complaintNumber++;
removeDuplicateSymptoms();
complaintConfirmed = false;
} else {
if (intentTag != null && intentTag.equals("edit")) {
Log.i(TAG, "fabClick: update" + insertion);
Expand Down Expand Up @@ -407,93 +398,13 @@ private void updateDatabase(String string) {
*/
private void setupQuestions(int complaintIndex) {
nodeComplete = false;

if (complaints.size() > 1) {
getAssociatedSymptoms(complaintIndex);
} else {
currentNode = complaintsNodes.get(complaintIndex);
}

currentNode = complaintsNodes.get(complaintIndex);
adapter = new CustomExpandableListAdapter(this, currentNode, this.getClass().getSimpleName());
questionListView.setAdapter(adapter);
questionListView.setChoiceMode(ExpandableListView.CHOICE_MODE_MULTIPLE);
questionListView.expandGroup(0);
setTitle(patientName + ": " + currentNode.findDisplay());
}

private void getAssociatedSymptoms(int complaintIndex) {

List<Node> assoComplaintsNodes = new ArrayList<>();
assoComplaintsNodes.addAll(complaintsNodes);

for (int i = 0; i < complaintsNodes.get(complaintIndex).size(); i++) {

if (complaintsNodes.get(complaintIndex).getOptionsList().get(i).getText()
.equalsIgnoreCase("Associated symptoms")) {

optionsList.addAll(complaintsNodes.get(complaintIndex).getOptionsList().get(i).getOptionsList());

assoComplaintsNodes.get(complaintIndex).getOptionsList().remove(i);
currentNode = assoComplaintsNodes.get(complaintIndex);
Log.e("CurrentNode", "" + currentNode);

}
}
}

private void removeDuplicateSymptoms() {

nodeComplete = false;

HashSet<String> hashSet = new HashSet<>();

List<Node> finalOptionsList = new ArrayList<>(optionsList);

if (optionsList.size() != 0) {

for (int i = 0; i < optionsList.size(); i++) {

if (hashSet.contains(optionsList.get(i).getText())) {

finalOptionsList.remove(optionsList.get(i));

} else {
hashSet.add(optionsList.get(i).getText());
}
}

try {
assoSympObj.put("id", "ID_294177528");
assoSympObj.put("text", "Associated symptoms");
assoSympObj.put("display", "Do you have the following symptom(s)?");
assoSympObj.put("display-or", "ତମର ଏହି ଲକ୍ଷଣ ସବୁ ଅଛି କି?");
assoSympObj.put("pos-condition", "c.");
assoSympObj.put("neg-condition", "s.");
assoSympArr.put(0, assoSympObj);
finalAssoSympObj.put("id", "ID_844006222");
finalAssoSympObj.put("text", "Associated symptoms");
finalAssoSympObj.put("display-or", "ପେଟଯନ୍ତ୍ରଣା");
finalAssoSympObj.put("perform-physical-exam", "");
finalAssoSympObj.put("options", assoSympArr);

} catch (JSONException e) {
e.printStackTrace();
}

assoSympNode = new Node(finalAssoSympObj);
assoSympNode.getOptionsList().get(0).setOptionsList(finalOptionsList);
assoSympNode.getOptionsList().get(0).setTerminal(false);

currentNode = assoSympNode;
adapter = new CustomExpandableListAdapter(this, currentNode, this.getClass().getSimpleName());
questionListView.setAdapter(adapter);
questionListView.setChoiceMode(ExpandableListView.CHOICE_MODE_MULTIPLE);
questionListView.expandGroup(0);
setTitle(patientName + ": " + currentNode.getText());

}
}

//Dialog Alert forcing user to answer all questions.
//Can be removed if necessary
//TODO: Add setting to allow for all questions unrequired..addAll(Arrays.asList(splitExams))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,7 @@ public void run() {
respiratory.setText(resp.getValue());
spO2View.setText(spO2.getValue());
if (complaint.getValue() != null)
complaintView.setText(Html.fromHtml(complaint.getValue().replace("○ c.", "<br>○ " + getResources().getString(R.string.patient_reports) + " ")
.replace("○ s.", "<br>○ " + getResources().getString(R.string.patient_denies) + " ")
.replace("c.", "")
.replace("s.", "")
.replace("<br/>• Associated symptoms -", "")));
complaintView.setText(Html.fromHtml(complaint.getValue()));
if (famHistory.getValue() != null)
famHistView.setText(Html.fromHtml(famHistory.getValue()));
if (patHistory.getValue() != null)
Expand Down Expand Up @@ -825,11 +821,7 @@ public void onClick(View v) {

final TextView complaintText = convertView.findViewById(R.id.textView_entry);
if (complaint.getValue() != null) {
complaintText.setText(Html.fromHtml(complaint.getValue().replace("○ c.", "<br>○ " + getResources().getString(R.string.patient_reports) + " ")
.replace("○ s.", "<br>○ " + getResources().getString(R.string.patient_denies) + " ")
.replace("c.", "")
.replace("s.", "")
.replace("<br/>• Associated symptoms -", "")));
complaintText.setText(Html.fromHtml(complaint.getValue()));
}
complaintText.setEnabled(false);

Expand All @@ -840,11 +832,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
textInput.setTitle(R.string.question_text_input);
final EditText dialogEditText = new EditText(VisitSummaryActivity.this);
if (complaint.getValue() != null) {
dialogEditText.setText(Html.fromHtml(complaint.getValue().replace("○ c.", "<br>○ " + getResources().getString(R.string.patient_reports) + " ")
.replace("○ s.", "<br>○ " + getResources().getString(R.string.patient_denies) + " ")
.replace("c.", "")
.replace("s.", "")
.replace("<br/>• Associated symptoms -", "")));
dialogEditText.setText(Html.fromHtml(complaint.getValue()));
} else {
dialogEditText.setText("");
}
Expand All @@ -854,16 +842,8 @@ public void onClick(DialogInterface dialogInterface, int i) {
public void onClick(DialogInterface dialog, int which) {
complaint.setValue(dialogEditText.getText().toString().replace("\n", "<br>"));
if (complaint.getValue() != null) {
complaintText.setText(Html.fromHtml(complaint.getValue().replace("○ c.", "<br>○ " + getResources().getString(R.string.patient_reports) + " ")
.replace("○ s.", "<br>○ " + getResources().getString(R.string.patient_denies) + " ")
.replace("c.", "")
.replace("s.", "")
.replace("<br/>• Associated symptoms -", "")));
complaintView.setText(Html.fromHtml(complaint.getValue().replace("○ c.", "<br>○ " + getResources().getString(R.string.patient_reports) + " ")
.replace("○ s.", "<br>○ " + getResources().getString(R.string.patient_denies) + " ")
.replace("c.", "")
.replace("s.", "")
.replace("<br/>• Associated symptoms -", "")));
complaintText.setText(Html.fromHtml(complaint.getValue()));
complaintView.setText(Html.fromHtml(complaint.getValue()));
}
updateDatabase(complaint.getValue(), UuidDictionary.CURRENT_COMPLAINT);
dialog.dismiss();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ public List<String> getImages(String encounterUUid, String ConceptUuid) throws D
}
}
idCursor.close();
localdb.setTransactionSuccessful();
localdb.endTransaction();
localdb.close();
} catch (SQLiteException e) {
throw new DAOException(e);
} finally {
Expand Down

0 comments on commit c1e3d15

Please sign in to comment.