|
@@ -30,6 +30,7 @@ import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
import com.dbs.mplus.knuh.BuildConfig;
|
|
|
+import com.dbs.mplus.knuh.MainActivity;
|
|
|
import com.dbs.mplus.knuh.R;
|
|
|
import com.dbs.mplus.knuh.activity.activityEvent.CenterMenu;
|
|
|
import com.dbs.mplus.knuh.activity.activityEvent.LeftMenu;
|
|
@@ -39,6 +40,7 @@ import com.dbs.mplus.knuh.activity.activityEvent.TopMenu;
|
|
|
import com.dbs.mplus.knuh.adapter.ConsentHistoryAdapter;
|
|
|
import com.dbs.mplus.knuh.adapter.ConsentTempAdapter;
|
|
|
import com.dbs.mplus.knuh.adapter.ViewPagerAdapter;
|
|
|
+import com.dbs.mplus.knuh.consent.ConsentFacade;
|
|
|
import com.dbs.mplus.knuh.consent.sign.SignWrapper;
|
|
|
import com.dbs.mplus.knuh.customView.CustomAlertDialog;
|
|
|
import com.dbs.mplus.knuh.customView.CustomRadioGroup;
|
|
@@ -47,10 +49,17 @@ import com.dbs.mplus.knuh.customView.SoftKeyboard;
|
|
|
import com.dbs.mplus.knuh.fragment.HistoryFragment;
|
|
|
import com.dbs.mplus.knuh.fragment.MarkerFragment;
|
|
|
import com.dbs.mplus.knuh.fragment.SearchFragment;
|
|
|
+import com.dbs.mplus.knuh.httpTask.HttpCallBack;
|
|
|
import com.dbs.mplus.knuh.model.PatientInfoVO;
|
|
|
import com.dbs.mplus.knuh.util.ConsentConfig;
|
|
|
import com.dbs.mplus.knuh.util.Util;
|
|
|
|
|
|
+import org.json.JSONObject;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+
|
|
|
public class ConsentActivity extends AppCompatActivity {
|
|
|
|
|
|
private static final String TAG = "ConsentActivity";
|
|
@@ -195,15 +204,6 @@ public class ConsentActivity extends AppCompatActivity {
|
|
|
mContext = this;
|
|
|
|
|
|
getIntentData();
|
|
|
-
|
|
|
-
|
|
|
- setTopMenuLayout();
|
|
|
- setTapMenuLayout();
|
|
|
- setLeftLayout();
|
|
|
- setCenterLayout();
|
|
|
- setRightLayout();
|
|
|
-
|
|
|
- setTopMenuEvent();
|
|
|
}
|
|
|
|
|
|
private void getIntentData() {
|
|
@@ -231,7 +231,204 @@ public class ConsentActivity extends AppCompatActivity {
|
|
|
Log.e(TAG, "drKind -- > " + drKind );
|
|
|
|
|
|
setLoadClass();
|
|
|
+
|
|
|
+ String saveUserId = Util.getStringPreference(mContext, "saveProc", "saveUserId");
|
|
|
+ String saveFormName = Util.getStringPreference(mContext, "saveProc", "saveFormName");
|
|
|
+ String saveType = Util.getStringPreference(mContext, "saveProc", "saveType");
|
|
|
+ String saveProcData = Util.getStringPreference(mContext, "saveProc", "saveProcData");
|
|
|
+ final HashMap saveData = Util.saveConsentData(saveProcData);
|
|
|
+
|
|
|
+
|
|
|
+ String eptFilePath = Util.getStringPreference(mContext, "saveProc", "eptFilePath");
|
|
|
+ final File eptFile = new File(eptFilePath);
|
|
|
+
|
|
|
+ String msg = "";
|
|
|
+ if (saveType.equals("SAVE")) {
|
|
|
+ msg = mContext.getString(R.string.cert);
|
|
|
+ } else if (saveType.equals("TEMP_SAVE")) {
|
|
|
+ msg = mContext.getString(R.string.temp);
|
|
|
+ } else if (saveType.equals("TEMP_SAVE2")) {
|
|
|
+ msg = getString(R.string.confirm);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (saveUserId.equals(userId) && eptFile.exists()) {
|
|
|
+ String message = String.format(getString(R.string.saveFailConsentMsg), msg, saveFormName);
|
|
|
+ csAlert.show();
|
|
|
+ csAlert.setContent(message, "");
|
|
|
+ csAlert.btnConfirm.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+
|
|
|
+ HashMap<String, Object> globalParam = Util.saveConsentData(saveData.get("globalParam").toString());
|
|
|
+ HashMap<String, Object> formListParam = Util.saveConsentData(saveData.get("formListParam").toString());
|
|
|
+ ArrayList<HashMap<String, Object>> mapArrayList = new ArrayList<>();
|
|
|
+ mapArrayList.add(formListParam);
|
|
|
+
|
|
|
+ HashMap map = new HashMap();
|
|
|
+ map.put("globalParam", globalParam);
|
|
|
+ map.put("formListParam", mapArrayList);
|
|
|
+
|
|
|
+ ConsentFacade consentFacade = new ConsentFacade(mContext, formListParam.get("consentStateEng").toString());
|
|
|
+ consentFacade.startConsent(map, "Y", "");
|
|
|
+ csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ csAlert.btnCancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ eptFile.delete();
|
|
|
+ Util.clearSaveProcData(mContext);
|
|
|
+ csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+// String saveUserId = Util.getStringPreference(mContext, "saveProc", "saveUserId");
|
|
|
+// String saveFormName = Util.getStringPreference(mContext, "saveProc", "saveFormName");
|
|
|
+// String saveType = Util.getStringPreference(mContext, "saveProc", "saveType");
|
|
|
+// String msg = "";
|
|
|
+// if (saveType.equals("SAVE")) {
|
|
|
+// msg = mContext.getString(R.string.cert);
|
|
|
+// } else if (saveType.equals("TEMP_SAVE")) {
|
|
|
+// msg = mContext.getString(R.string.temp);
|
|
|
+// } else if (saveType.equals("TEMP_SAVE2")) {
|
|
|
+// msg = getString(R.string.confirm);
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (saveUserId.equals(userId)) {
|
|
|
+// String message = String.format(getString(R.string.saveFailConsentMsg), msg, saveFormName);
|
|
|
+// csAlert.show();
|
|
|
+// csAlert.setContent(message, "");
|
|
|
+// csAlert.btnConfirm.setOnClickListener(new View.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(View v) {
|
|
|
+// saveConsentProc(0);
|
|
|
+// csAlert.dismiss();
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+// csAlert.btnCancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(View v) {
|
|
|
+// Util.clearSaveProcData(mContext);
|
|
|
+// setContentLoad();
|
|
|
+// csAlert.dismiss();
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// setContentLoad();
|
|
|
+// }
|
|
|
+
|
|
|
+ setContentLoad();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setContentLoad() {
|
|
|
+ runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ setTopMenuLayout();
|
|
|
+ setTapMenuLayout();
|
|
|
+ setLeftLayout();
|
|
|
+ setCenterLayout();
|
|
|
+ setRightLayout();
|
|
|
+
|
|
|
+ setTopMenuEvent();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 저장 실패한 동의서를 불러와 재시도
|
|
|
+ * @author jksong
|
|
|
+ * @since 2020-10-22 오전 10:36
|
|
|
+ **/
|
|
|
+ private void saveConsentProc(int count) {
|
|
|
+ showProgress();
|
|
|
+ final int cnt = count;
|
|
|
+ String saveProcData = Util.getStringPreference(mContext, "saveProc", "saveProcData");
|
|
|
+ String saveUserId = Util.getStringPreference(mContext, "saveProc", "saveUserId");
|
|
|
+ String saveUserJobKindCd = Util.getStringPreference(mContext, "saveProc", "saveUserJobKindCd");
|
|
|
+ String saveAction = Util.getStringPreference(mContext, "saveProc", "saveAction");
|
|
|
+ String saveMethod = Util.getStringPreference(mContext, "saveProc", "saveMethod");
|
|
|
+ HashMap saveData = Util.saveConsentData(saveProcData);
|
|
|
+
|
|
|
+ if (saveUserId.equals(userId)) {
|
|
|
+ HttpCallBack callBack = new HttpCallBack() {
|
|
|
+ @Override
|
|
|
+ public void result(String result) {
|
|
|
+ Log.e(TAG, "result -- > " + result);
|
|
|
+ dismissProgress();
|
|
|
+ if (result == null || result.equals("")) {
|
|
|
+ stop();
|
|
|
+ } else {
|
|
|
+ JSONObject object = Util.xmltoJsonObject(result);
|
|
|
+ String res = Util.xmlToJsonString(object);
|
|
|
+ ArrayList<HashMap<String, String>> mapArrayList = Util.parseJSON(mContext, res);
|
|
|
+
|
|
|
+ String strRts = mapArrayList.get(0).get("responseData");
|
|
|
+
|
|
|
+ int rts = Integer.parseInt(strRts);
|
|
|
+ if (rts == -1) {
|
|
|
+ stop();
|
|
|
+ } else {
|
|
|
+ Util.clearSaveProcData(mContext);
|
|
|
+ setContentLoad();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void stop() {
|
|
|
+ csAlert.show();
|
|
|
+ String message = "";
|
|
|
+ if (cnt < 3) {
|
|
|
+ message = String.format(getString(R.string.saveFailreTryMsg), String.valueOf(cnt));
|
|
|
+ csAlert.setContent(message, "");
|
|
|
+ csAlert.btnConfirm.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ saveConsentProc(cnt + 1);
|
|
|
+ csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ csAlert.btnCancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ Util.clearSaveProcData(mContext);
|
|
|
+ setContentLoad();
|
|
|
+ csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ message = getString(R.string.saveFail);
|
|
|
+ csAlert.setContent(message, ConsentConfig.ALERT_BTN_TYPE);
|
|
|
+ csAlert.btnConfirm2.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ Util.clearSaveProcData(mContext);
|
|
|
+ setContentLoad();
|
|
|
+ csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void error() {
|
|
|
+
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ Util.callHttpUrlConnection(mContext, saveAction, saveMethod, saveData, callBack);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
|
|
|
private void setLoadClass() {
|
|
|
loadingProgress = new LoadingProgress(mContext);
|