From e63b372eb4e22487e435bea6a8fcd62b0fd34de4 Mon Sep 17 00:00:00 2001 From: Sagar S Date: Fri, 15 Nov 2019 15:41:49 +0530 Subject: [PATCH] Fixed issue #557 - Improve the formatting for associated complaints --- .../QuestionNodeActivity.java | 90 +------------------ 1 file changed, 1 insertion(+), 89 deletions(-) diff --git a/app/src/main/java/io/intelehealth/client/activities/questionNodeActivity/QuestionNodeActivity.java b/app/src/main/java/io/intelehealth/client/activities/questionNodeActivity/QuestionNodeActivity.java index 751fe93bf2..816c89c789 100644 --- a/app/src/main/java/io/intelehealth/client/activities/questionNodeActivity/QuestionNodeActivity.java +++ b/app/src/main/java/io/intelehealth/client/activities/questionNodeActivity/QuestionNodeActivity.java @@ -77,12 +77,6 @@ public class QuestionNodeActivity extends AppCompatActivity { private String encounterVitals; private String encounterAdultIntials; - private List 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) { sessionManager = new SessionManager(this); @@ -290,10 +284,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); @@ -408,11 +398,7 @@ 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); @@ -420,80 +406,6 @@ private void setupQuestions(int complaintIndex) { questionListView.expandGroup(0); setTitle(patientName + ": " + currentNode.findDisplay()); } - - private void getAssociatedSymptoms(int complaintIndex) { - - List 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 hashSet = new HashSet<>(); - - List 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))