Browse Source

Revert "동의서 찾기 카테고리 스피너 추가"

This reverts commit 52e6221b0706d9c597c72b6f3c5424f11e7cf01a.
songjunekeun 5 năm trước cách đây
mục cha
commit
c2576a3315

+ 54 - 7
app/src/main/java/com/dbs/mplus/knuh/fragment/SearchFragment.java

@@ -63,12 +63,53 @@ public class SearchFragment extends Fragment {
     searchDeptLayout      = (LinearLayout) view.findViewById(R.id.searchDeptLayout);
     searchDeptSpinner     = (Spinner) view.findViewById(R.id.searchDeptSpinner);
 
-    getHospitalList(BuildConfig.INST_CD);
+    getHospitalList("1");
 
     return view;
   }
 
-  private void getHospitalList(final String instCd) {
+  private void getHospitalList(final String categoryId) {
+    CallBack callBack = new CallBack() {
+      @Override
+      public void result(SoapObject result) {
+        Log.e(TAG, "getHospitalList --> " + result);
+        if (result == null || result.toString().indexOf("null") > 0) {
+          stop();
+        } else {
+          ArrayList<CategoryVO> arrayList = SoapParser.getHospitalList(result);
+          if (arrayList.size() == 0) {
+            stop();
+          } else {
+            setSpinnerAdapter(arrayList, categoryId);
+          }
+
+          for (int i = 0; i < arrayList.size(); i++) {
+            CategoryVO categoryVO = arrayList.get(i);
+            String categoryId = categoryVO.getCategoryId();
+            if (categoryId.equals("EMA_" + BuildConfig.INST_CD)) {
+              getHospitalRowList(categoryId);
+            }
+          }
+        }
+      }
+      @Override
+      public void stop() {
+//        ArrayList<CategoryVO> arrayList = new ArrayList<CategoryVO>();
+//        arrayList.add(new CategoryVO("", "", "전체"));
+//        setSpinnerAdapter(arrayList);
+      }
+      @Override
+      public void error() {
+
+      }
+    };
+
+    HashMap<String, String> mData = new HashMap<String, String>();
+    mData.put("categoryId", categoryId);
+    Util.callHttp(mContext, ConsentConfig.HOST_CONSENT, ConsentConfig.GET_CONSENT_CATEGORYY, mData, callBack);
+  }
+
+  private void getHospitalRowList(final String categoryId) {
     CallBack callBack = new CallBack() {
       @Override
       public void result(SoapObject result) {
@@ -77,7 +118,7 @@ public class SearchFragment extends Fragment {
           stop();
         } else {
           ArrayList<CategoryVO> arrayList = SoapParser.getHospitalList(result);
-          setSpinnerAdapter(arrayList);
+          setSpinnerAdapter(arrayList, categoryId);
         }
       }
 
@@ -93,18 +134,24 @@ public class SearchFragment extends Fragment {
     };
 
     HashMap<String, String> mData = new HashMap<String, String>();
-    mData.put("categoryId", instCd);
+    mData.put("categoryId", categoryId);
     Util.callHttp(mContext, ConsentConfig.HOST_CONSENT, ConsentConfig.GET_CONSENT_CATEGORYY, mData, callBack);
   }
 
-  private void setSpinnerAdapter(final ArrayList arrayList) {
+  private void setSpinnerAdapter(final ArrayList arrayList, final String categoryId) {
     mActivity.runOnUiThread(new Runnable() {
       @Override
       public void run() {
         categoryAdapter = new CategoryAdapter(mActivity, arrayList);
-        searchDeptSpinner.setAdapter(categoryAdapter);
-
+        
+        if (categoryId.equals("EMA_" + BuildConfig.INST_CD)) {
+          searchDeptSpinner.setAdapter(categoryAdapter);
+        }
       }
     });
   }
+
+
+
+
 }