|
@@ -1,5 +1,6 @@
|
|
|
package com.dbs.mplus.knuh.adapter;
|
|
|
|
|
|
+import android.bluetooth.BluetoothDevice;
|
|
|
import android.content.Context;
|
|
|
import android.graphics.drawable.GradientDrawable;
|
|
|
import android.util.Log;
|
|
@@ -16,15 +17,21 @@ import androidx.appcompat.app.AppCompatActivity;
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
+import com.dbs.mplus.knuh.BuildConfig;
|
|
|
import com.dbs.mplus.knuh.R;
|
|
|
import com.dbs.mplus.knuh.activity.ConsentActivity;
|
|
|
import com.dbs.mplus.knuh.consent.ConsentCreateParam;
|
|
|
import com.dbs.mplus.knuh.consent.ConsentEvent;
|
|
|
import com.dbs.mplus.knuh.consent.ConsentFacade;
|
|
|
+import com.dbs.mplus.knuh.consent.sign.SignWrapper;
|
|
|
+import com.dbs.mplus.knuh.customView.CustomDeleteAlert;
|
|
|
+import com.dbs.mplus.knuh.httpTask.CallBack;
|
|
|
import com.dbs.mplus.knuh.model.ConsentFormListVO;
|
|
|
import com.dbs.mplus.knuh.util.ConsentConfig;
|
|
|
import com.dbs.mplus.knuh.util.Util;
|
|
|
|
|
|
+import org.ksoap2.serialization.SoapObject;
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
|
|
@@ -39,6 +46,8 @@ public class ConsentTempAdapter extends RecyclerView.Adapter<ConsentTempAdapter.
|
|
|
|
|
|
private HashMap<Integer, Object> checkMap;
|
|
|
|
|
|
+ private CustomDeleteAlert customDeleteAlert = null;
|
|
|
+
|
|
|
public ConsentTempAdapter(AppCompatActivity mActivity, Context mContext, ArrayList<ConsentFormListVO> arrayList) {
|
|
|
this.mActivity = mActivity;
|
|
|
this.mContext = mContext;
|
|
@@ -118,12 +127,12 @@ public class ConsentTempAdapter extends RecyclerView.Adapter<ConsentTempAdapter.
|
|
|
holder.tvTemp.setVisibility(View.VISIBLE);
|
|
|
holder.tvSubText.setText(mContext.getString(R.string.delete));
|
|
|
tvSubBg.setColor(ContextCompat.getColor(mContext, R.color.alertColor));
|
|
|
-// holder.tvSubText.setOnClickListener(onClickListener);
|
|
|
+ holder.tvSubText.setOnClickListener(onClickListener);
|
|
|
} else if (consentStateEng.equals(ConsentConfig.UNFINISHED)) {
|
|
|
holder.tvTemp.setVisibility(View.VISIBLE);
|
|
|
holder.tvSubText.setText(mContext.getString(R.string.delete));
|
|
|
tvSubBg.setColor(ContextCompat.getColor(mContext, R.color.alertColor));
|
|
|
-// holder.tvSubText.setOnClickListener(onClickListener);
|
|
|
+ holder.tvSubText.setOnClickListener(onClickListener);
|
|
|
|
|
|
} else {
|
|
|
holder.tvTemp.setVisibility(View.GONE);
|
|
@@ -143,53 +152,182 @@ public class ConsentTempAdapter extends RecyclerView.Adapter<ConsentTempAdapter.
|
|
|
ViewHolder holder = (ViewHolder) v.getTag();
|
|
|
final int position = holder.getLayoutPosition();
|
|
|
ConsentFormListVO consentFormListVO = arrayList.get(position);
|
|
|
+ final String formName = consentFormListVO.getFormName();
|
|
|
+ final String consentMstRid = consentFormListVO.getConsentMstRid();
|
|
|
+ final String pid = consentFormListVO.getPid();
|
|
|
+ final String ordDeptCd = consentFormListVO.getOrdDeptCd();
|
|
|
+ final String formCd = consentFormListVO.getFormCd();
|
|
|
+ final String ordType = consentFormListVO.getOrdType();
|
|
|
+ final String inDd = consentFormListVO.getInDd();
|
|
|
+ final String ocrTag = consentFormListVO.getOcrTag();
|
|
|
+ final String cretNo = consentFormListVO.getCretNo();
|
|
|
+ final String pageCnt = consentFormListVO.getPageCnt();
|
|
|
String consentStateEng = consentFormListVO.getConsentStateEng();
|
|
|
|
|
|
- consentEvent = new ConsentEvent(mContext, instance, consentFormListVO);
|
|
|
- if (checkMap.size() == 0) {
|
|
|
- consentEvent.consentOpenProc(instance.centerMenu.patientInfoVO, "centerTemp");
|
|
|
+ if (holder.listLayer == v) {
|
|
|
+ holder.chkConsent.setChecked(true);
|
|
|
|
|
|
- ConsentHistoryAdapter adapter = (ConsentHistoryAdapter) instance.history.historyWriteRecyclerView.getAdapter();
|
|
|
- if (adapter != null) {
|
|
|
- adapter.arrayList.clear();
|
|
|
- adapter = null;
|
|
|
- }
|
|
|
- } else {
|
|
|
- String certPass = "N";
|
|
|
- HashMap<String, String> multiGlobalMap = new HashMap<String, String>();
|
|
|
- ArrayList<HashMap<String, String>> multiFormArray = new ArrayList<HashMap<String, String>>();
|
|
|
- HashMap<String, Object> consentMap = new HashMap<String, Object>();
|
|
|
-
|
|
|
- ConsentCreateParam consentCreateParam = new ConsentCreateParam(mContext);
|
|
|
- multiGlobalMap = consentCreateParam.setMultiGlobalParam(instance.centerMenu.patientInfoVO);
|
|
|
- for (int key : checkMap.keySet()) {
|
|
|
- Log.e(TAG, "key -- > " + key);
|
|
|
- ConsentFormListVO consentFormVO = arrayList.get(key);
|
|
|
- String _certPass = consentFormVO.getCertUseYn();
|
|
|
-// String consentMstRid = consentFormVO.getConsentMstRid();
|
|
|
-// String formRid = consentFormVO.getFormRid();
|
|
|
-// String guid = consentFormVO.getFormGuid();
|
|
|
-// String formPrntNm = consentFormVO.getFormPrntNm();
|
|
|
-// String linkCd = consentFormVO.getLinkFormCd();
|
|
|
-// String ocrTag = consentFormVO.getOcrTag();
|
|
|
-// String userDrFlag = consentFormVO.getUserDrFlag();
|
|
|
-// String consentState = consentFormVO.getConsentState();
|
|
|
-// String consentStateEng = consentFormVO.getConsentStateEng();
|
|
|
-
|
|
|
- if (_certPass.equals("Y")) {
|
|
|
+ consentEvent = new ConsentEvent(mContext, instance, consentFormListVO);
|
|
|
+ if (checkMap.size() < 2) {
|
|
|
+ consentEvent.consentOpenProc(instance.centerMenu.patientInfoVO, "centerTemp");
|
|
|
+
|
|
|
+ ConsentHistoryAdapter adapter = (ConsentHistoryAdapter) instance.history.historyWriteRecyclerView.getAdapter();
|
|
|
+ if (adapter != null) {
|
|
|
+ adapter.arrayList.clear();
|
|
|
+ adapter = null;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ int count = 0;
|
|
|
+ String certPass = "";
|
|
|
+ String state = "";
|
|
|
+ HashMap<String, String> multiGlobalMap = new HashMap<String, String>();
|
|
|
+ ArrayList<HashMap<String, String>> multiFormArray = new ArrayList<HashMap<String, String>>();
|
|
|
+ HashMap<String, Object> consentMap = new HashMap<String, Object>();
|
|
|
+
|
|
|
+ ConsentCreateParam consentCreateParam = new ConsentCreateParam(mContext);
|
|
|
+ multiGlobalMap = consentCreateParam.setMultiGlobalParam(instance.centerMenu.patientInfoVO);
|
|
|
+ for (int key : checkMap.keySet()) {
|
|
|
+ Log.e(TAG, "key -- > " + key);
|
|
|
+ ConsentFormListVO consentFormVO = arrayList.get(key);
|
|
|
+ String _consentStateEng = consentFormVO.getConsentStateEng();
|
|
|
+ String _certPass = consentFormVO.getCertUseYn();
|
|
|
+
|
|
|
+// if (_consentStateEng.equals(ConsentConfig.ELECTR_CMP)) {
|
|
|
+// instance.csAlert.show();
|
|
|
+// instance.csAlert.setContent(mContext.getString(R.string.electrCmpCheckeMsg), ConsentConfig.ALERT_BTN_TYPE);
|
|
|
+// instance.csAlert.btnConfirm2.setOnClickListener(new View.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(View v) {
|
|
|
+// instance.csAlert.dismiss();
|
|
|
+// }
|
|
|
+// });
|
|
|
+// return;
|
|
|
+// }
|
|
|
+
|
|
|
+ HashMap<String, String> formMap = consentCreateParam.setMultiFormParam(instance.centerMenu.patientInfoVO, consentFormVO);
|
|
|
+ multiFormArray.add(formMap);
|
|
|
+
|
|
|
+ state += _consentStateEng;
|
|
|
+ if (checkMap.size() -1 > count) {
|
|
|
+ state += ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ certPass += _certPass;
|
|
|
+ if (checkMap.size() - 1 > count) {
|
|
|
+ certPass += ",";
|
|
|
+ }
|
|
|
+
|
|
|
+ count = count + 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ consentMap.put("globalParam", multiGlobalMap);
|
|
|
+ consentMap.put("formListParam", multiFormArray);
|
|
|
+
|
|
|
+ String[] stateAr = state.split(",");
|
|
|
+ boolean sameFlag = Util.allElementsTheSame(stateAr);
|
|
|
+ if (sameFlag == false) {
|
|
|
+ for (String data : stateAr) {
|
|
|
+ if (data.equals(ConsentConfig.ELECTR_CMP)) {
|
|
|
+ instance.csAlert.show();
|
|
|
+ instance.csAlert.setContent(mContext.getString(R.string.electrCmpCheckeMsg), ConsentConfig.ALERT_BTN_TYPE);
|
|
|
+ instance.csAlert.btnConfirm2.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ instance.csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (certPass.indexOf("N") > -1) {
|
|
|
+ if (SignWrapper.getInstance().isCertificate(userId) == true) {
|
|
|
+ certPass = "N";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
certPass = "Y";
|
|
|
}
|
|
|
|
|
|
- HashMap<String, String> formMap = consentCreateParam.setMultiFormParam(instance.centerMenu.patientInfoVO, consentFormVO);
|
|
|
- multiFormArray.add(formMap);
|
|
|
+ ConsentFacade consentFacade = new ConsentFacade(mContext, consentStateEng);
|
|
|
+ consentFacade.startConsent(consentMap, certPass, "centerTemp");
|
|
|
}
|
|
|
+ } else if (holder.tvSubText == v) {
|
|
|
+ String message = String.format(mContext.getString(R.string.deleteConsent), formName);
|
|
|
+ instance.csAlert.show();
|
|
|
+ instance.csAlert.setContent(message, "");
|
|
|
+ instance.csAlert.btnConfirm.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ instance.csAlert.dismiss();
|
|
|
+
|
|
|
+ CallBack callBack = new CallBack() {
|
|
|
+ @Override
|
|
|
+ public void result(final SoapObject result) {
|
|
|
+ ((ConsentActivity) mContext).runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if (result == null) {
|
|
|
+ stop();
|
|
|
+ } else {
|
|
|
+ String res = result.getProperty("responseData").toString().trim();
|
|
|
+ int intRes = Integer.parseInt(res);
|
|
|
+
|
|
|
+ if (intRes == -1) {
|
|
|
+ stop();
|
|
|
+ } else {
|
|
|
+ customDeleteAlert.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ((ConsentActivity) mContext).dismissProgress();
|
|
|
+ arrayList.remove(position);
|
|
|
+ notifyItemRemoved(position);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void stop() {
|
|
|
+ String message = String.format(mContext.getString(R.string.deleteConsentFailed), formName);
|
|
|
+ ((ConsentActivity) mContext).showSingButtonDialog(message);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void error() {
|
|
|
+
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ String userId = Util.getStringPreference(mContext, "userInfo", "userId");
|
|
|
+ String userDeptCd = Util.getStringPreference(mContext, "userInfo", "deptCd");
|
|
|
+ HashMap<String, String> mData = new HashMap<String, String>();
|
|
|
+ mData.put("userId", userId);
|
|
|
+ mData.put("consentMstRid", consentMstRid);
|
|
|
+ mData.put("patientCode", pid);
|
|
|
+ mData.put("clnDeptCode", ordDeptCd);
|
|
|
+ mData.put("formCd", formCd);
|
|
|
+ mData.put("vistType", ordType);
|
|
|
+ mData.put("hosType", BuildConfig.INST_CD);
|
|
|
+ mData.put("clnDate", inDd);
|
|
|
+ mData.put("ocrCode", ocrTag);
|
|
|
+ mData.put("cretno", cretNo);
|
|
|
+ mData.put("userDeptCd", userDeptCd);
|
|
|
+ mData.put("pageCnt", pageCnt);
|
|
|
+ mData.put("clientType", ConsentConfig.CLIENT_TYPE);
|
|
|
+ mData.put("formName", formName);
|
|
|
+
|
|
|
+ customDeleteAlert = new CustomDeleteAlert(mContext, mData, callBack);
|
|
|
+ customDeleteAlert.show();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- Log.e(TAG, "multiGlobalMap -- > " + multiGlobalMap);
|
|
|
- Log.e(TAG, "multiFormArray -- > " + multiFormArray);
|
|
|
- consentMap.put("globalParam", multiGlobalMap);
|
|
|
- consentMap.put("formListParam", multiFormArray);
|
|
|
- ConsentFacade consentFacade = new ConsentFacade(mContext, consentStateEng);
|
|
|
- consentFacade.startConsent(consentMap, certPass, "centerTemp");
|
|
|
+ instance.csAlert.btnCancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ instance.csAlert.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
}
|