123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679 |
- package com.dbs.dbsec.activity.activityEvent;
- import android.annotation.SuppressLint;
- import android.app.DatePickerDialog;
- import android.content.Context;
- import android.util.Log;
- import android.view.View;
- import android.widget.AdapterView;
- import android.widget.DatePicker;
- import android.widget.RelativeLayout;
- import android.widget.Spinner;
- import android.widget.Toast;
- import androidx.appcompat.app.AppCompatActivity;
- import androidx.appcompat.widget.AppCompatRadioButton;
- import androidx.recyclerview.widget.LinearLayoutManager;
- import com.dbs.dbsec.BuildConfig;
- import com.dbs.dbsec.R;
- import com.dbs.dbsec.activity.ConsentActivity;
- import com.dbs.dbsec.activity.adapter.DeptSpinnerAdapter;
- import com.dbs.dbsec.activity.adapter.PatientListAdapter;
- import com.dbs.dbsec.customView.CustomRadioGroup;
- import com.dbs.dbsec.httpTask.CallBack;
- import com.dbs.dbsec.httpTask.ParseJsonData;
- import com.dbs.dbsec.model.DeptListVO;
- import com.dbs.dbsec.model.DoctorListVO;
- import com.dbs.dbsec.model.PatientListVO;
- import com.dbs.dbsec.util.Common;
- import com.dbs.dbsec.util.ConsentConfig;
- import com.raonsecure.touchen_mguard_4_0.utils.Util;
- import java.util.ArrayList;
- import java.util.HashMap;
- public class LeftMenu {
- private static final String TAG = "LeftMenu";
- private AppCompatActivity mActivity;
- private Context mContext;
- private ConsentActivity instance;
- private DeptSpinnerAdapter deptSpinnerAdapter;
- public PatientListAdapter patientListAdapter;
- private LinearLayoutManager linearLayoutManager;
- // private
- private DatePickerDialog dateDialog;
- private HashMap<String, String> patientSearchMap = null;
- public String patientState = "";
- public LeftMenu(Context mContext, AppCompatActivity mActivity) {
- this.mContext = mContext;
- this.mActivity = mActivity;
- this.instance = (ConsentActivity) mContext;
- this.patientSearchMap = new HashMap<String, String>();
- int year = Common.toDayDate()[0];
- int month = Integer.parseInt(Common.plusZero(Common.toDayDate()[1] - 1));
- int day = Integer.parseInt(Common.plusZero(Common.toDayDate()[2]));
- this.dateDialog = new DatePickerDialog(mContext, R.style.DatePickerDialogTheme, onDateSetListener, year, month, day);
- }
- @SuppressLint("RestrictedApi")
- public void setRadioGroupDraw(String indexPage) {
- instance.radioGroup = new CustomRadioGroup(mContext);
- instance.radioGroupParams = new CustomRadioGroup.LayoutParams(CustomRadioGroup.LayoutParams.WRAP_CONTENT, CustomRadioGroup.LayoutParams.WRAP_CONTENT);
- instance.radioGroupParams.addRule(RelativeLayout.CENTER_IN_PARENT);
- String radioStr1 = "";
- String radioStr2 = "";
- String radioStr3 = "";
- String radioStr4 = "";
- String radioStr5 = "";
- if (indexPage.equals("I")) {
- radioStr1 = mContext.getString(R.string.stay);
- radioStr2 = mContext.getString(R.string.hospitalization);
- radioStr3 = mContext.getString(R.string.discharge);
- radioStr4 = mContext.getString(R.string.noWrite);
- } else if (indexPage.equals("O")) {
- radioStr1 = mContext.getString(R.string.all);
- radioStr2 = mContext.getString(R.string.accept);
- radioStr3 = mContext.getString(R.string.waiting);
- radioStr4 = mContext.getString(R.string.complete);
- radioStr5 = mContext.getString(R.string.noWrite);
- } else if (indexPage.equals("E")) {
- radioStr1 = mContext.getString(R.string.stay);
- radioStr2 = mContext.getString(R.string.discharge);
- radioStr3 = mContext.getString(R.string.leaveClear);
- radioStr4 = mContext.getString(R.string.noWrite);
- } else if (indexPage.equals("OP")) {
- radioStr1 = mContext.getString(R.string.all);
- radioStr2 = mContext.getString(R.string.notYet);
- radioStr3 = mContext.getString(R.string.ready);
- radioStr4 = mContext.getString(R.string.ing);
- radioStr5 = mContext.getString(R.string.complete);
- } else if (indexPage.equals("SR")) {
- radioStr1 = mContext.getString(R.string.admission);
- radioStr2 = mContext.getString(R.string.outPatient);
- radioStr3 = mContext.getString(R.string.emergency);
- }
- if (indexPage.equals("O") || indexPage.equals("OP")) {
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioButton1 = new AppCompatRadioButton(mContext);
- instance.radioButton1.setText(radioStr1);
- instance.radioButton1.setTextSize(14);
- instance.radioButton1.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton1);
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioParams.addRule(RelativeLayout.RIGHT_OF, instance.radioButton1.getId());
- instance.radioButton2 = new AppCompatRadioButton(mContext);
- instance.radioButton2.setText(radioStr2);
- instance.radioButton2.setTextSize(14);
- instance.radioButton2.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton2);
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioParams.addRule(RelativeLayout.RIGHT_OF, instance.radioButton2.getId());
- instance.radioButton3 = new AppCompatRadioButton(mContext);
- instance.radioButton3.setText(radioStr3);
- instance.radioButton3.setTextSize(14);
- instance.radioButton3.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton3);
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioParams.addRule(RelativeLayout.BELOW, instance.radioButton3.getId());
- instance.radioButton4 = new AppCompatRadioButton(mContext);
- instance.radioButton4.setText(radioStr4);
- instance.radioButton4.setTextSize(14);
- instance.radioButton4.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton4);
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioParams.addRule(RelativeLayout.BELOW, instance.radioButton2.getId());
- instance.radioParams.addRule(RelativeLayout.RIGHT_OF, instance.radioButton4.getId());
- instance.radioButton5 = new AppCompatRadioButton(mContext);
- instance.radioButton5.setText(radioStr5);
- instance.radioButton5.setTextSize(14);
- instance.radioButton5.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton5);
- } else {
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioButton1 = new AppCompatRadioButton(mContext);
- instance.radioButton1.setText(radioStr1);
- instance.radioButton1.setTextSize(14);
- instance.radioButton1.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton1);
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioParams.addRule(RelativeLayout.RIGHT_OF, instance.radioButton1.getId());
- instance.radioButton2 = new AppCompatRadioButton(mContext);
- instance.radioButton2.setText(radioStr2);
- instance.radioButton2.setTextSize(14);
- instance.radioButton2.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton2);
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioParams.addRule(RelativeLayout.RIGHT_OF, instance.radioButton2.getId());
- instance.radioButton3 = new AppCompatRadioButton(mContext);
- instance.radioButton3.setText(radioStr3);
- instance.radioButton3.setTextSize(14);
- instance.radioButton3.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton3);
- if (!indexPage.equals("SR")) {
- instance.radioParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
- instance.radioParams.addRule(RelativeLayout.RIGHT_OF, instance.radioButton3.getId());
- instance.radioButton4 = new AppCompatRadioButton(mContext);
- instance.radioButton4.setText(radioStr4);
- instance.radioButton4.setTextSize(14);
- instance.radioButton4.setLayoutParams(instance.radioParams);
- instance.radioGroup.addView(instance.radioButton4);
- }
- }
- if (instance.jobKindCd.indexOf("03") == 0 || instance.indexPage.equals("SR")) {
- instance.radioButton1.setChecked(true);
- patientState = "A";
- } else {
- if (indexPage.equals("SR")) {
- instance.radioButton1.setChecked(true);
- patientState = "A";
- } else {
- if (indexPage.equals("I") || indexPage.equals("E")) {
- instance.radioButton4.setChecked(true);
- patientState = "C";
- } else if (indexPage.equals("O")) {
- instance.radioButton5.setChecked(true);
- patientState = "3";
- } else if (indexPage.equals("OP")) {
- instance.radioButton1.setChecked(true);
- patientState = "A";
- }
- }
- }
- instance.radioLayout.addView(instance.radioGroup, instance.radioGroupParams);
- }
- private DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
- @Override
- public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
- String date = year + "/" + Common.plusZero(month + 1) + "/" + Common.plusZero(dayOfMonth);
- setDate(date);
- }
- };
- public View.OnClickListener onClickListener = new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (instance.dateLayout == v) {
- //진료 일자 선택
- dateDialog.show();
- } else if (instance.patientSearchLayout == v) {
- //등록번호 검색 input 옆의 조회 버튼
- getPatientList();
- }
- }
- };
- public CustomRadioGroup.OnCheckedChangeListener onCheckedChangeListener = new CustomRadioGroup.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CustomRadioGroup group, int checkedId) {
- if (checkedId == instance.radioButton1.getId()) {
- patientState = "A";
- } else if (checkedId == instance.radioButton2.getId()) {
- patientState = "0";
- } else if (checkedId == instance.radioButton3.getId()) {
- patientState = "1";
- } else if (checkedId == instance.radioButton4.getId()) {
- if (instance.indexPage.equals("I") || instance.indexPage.equals("ER")) {
- patientState = "C";
- } else {
- patientState = "2";
- }
- } else if (checkedId == instance.radioButton5.getId()) {
- if (instance.indexPage.equals("OP") || instance.indexPage.equals("O")) {
- patientState = "3";
- } else {
- patientState = "C";
- }
- }
- Log.e(TAG, "patientState -- > " + patientState);
- }
- };
- private void setDate(String date) {
- instance.tvMainDate.setText(date);
- }
- public String getDate() {
- return Common.removeSlashStr(instance.tvMainDate.getText().toString().trim());
- }
- public void getWardList() {
- CallBack callBack = new CallBack() {
- @Override
- public void result(String result) {
- ArrayList<HashMap<String, String>> rts = Common.parseJSON(mContext, result);
- String code = rts.get(0).get("code");
- if (!code.equals("00")) {
- stop();
- } else {
- ArrayList<DeptListVO> dataAr = ParseJsonData.getInstance(mContext).getWardNDeptList(rts);
- setSpinnerAdapter(dataAr, ConsentConfig.GET_WARD_LIST);
- }
- }
- @Override
- public void stop() {
- ArrayList<DeptListVO> arrayList = new ArrayList<DeptListVO>();
- arrayList.add(new DeptListVO("", mContext.getString(R.string.wardListEmpty)));
- setSpinnerAdapter(arrayList, ConsentConfig.GET_WARD_LIST);
- }
- @Override
- public void error() {
- }
- };
- HashMap<String, String> mData = new HashMap<String, String>();
- mData.put("instCd", BuildConfig.INST_CD);
- if (Common.checkNetwork(mContext) == true) {
- Common.callHttp(mContext, ConsentConfig.GET_WARD_LIST, mData, callBack);
- } else {
- instance.dismissProgress();
- Common.networkErrorAlert(mActivity);
- }
- }
- public void getDeptList() {
- CallBack callBack = new CallBack() {
- @Override
- public void result(String result) {
- ArrayList<HashMap<String, String>> rts = Common.parseJSON(mContext, result);
- String code = rts.get(0).get("code");
- if (!code.equals("00")) {
- stop();
- } else {
- ArrayList<DeptListVO> dataAr = ParseJsonData.getInstance(mContext).getWardNDeptList(rts);
- setSpinnerAdapter(dataAr, ConsentConfig.GET_DEPT_LIST);
- }
- }
- @Override
- public void stop() {
- ArrayList<DeptListVO> arrayList = new ArrayList<DeptListVO>();
- arrayList.add(new DeptListVO("", mContext.getString(R.string.deptListEmpty)));
- setSpinnerAdapter(arrayList, ConsentConfig.GET_DEPT_LIST);
- }
- @Override
- public void error() {
- }
- };
- HashMap<String, String> mData = new HashMap<String, String>();
- mData.put("instCd", BuildConfig.INST_CD);
- mData.put("ordType", instance.indexPage);
- if (Common.checkNetwork(mContext) == true) {
- Common.callHttp(mContext, ConsentConfig.GET_DEPT_LIST, mData, callBack);
- } else {
- instance.dismissProgress();
- Common.networkErrorAlert(mActivity);
- }
- }
- private void getDoctorList(String deptCd) {
- CallBack callBack = new CallBack() {
- @Override
- public void result(String result) {
- Log.e(TAG, "result -- > " + result);
- ArrayList<HashMap<String, String>> rts = Common.parseJSON(mContext, result);
- String code = rts.get(0).get("code");
- if (!code.equals("00")) {
- stop();
- } else {
- ArrayList<DoctorListVO> dataAr = ParseJsonData.getInstance(mContext).getDoctorList(rts);
- setSpinnerAdapter(dataAr, ConsentConfig.GET_DOCTOR_LIST);
- }
- }
- @Override
- public void stop() {
- ArrayList<DoctorListVO> arrayList = new ArrayList<DoctorListVO>();
- arrayList.add(new DoctorListVO("", mContext.getString(R.string.doctorListEmpty), "", ""));
- setSpinnerAdapter(arrayList, ConsentConfig.GET_DOCTOR_LIST);
- }
- @Override
- public void error() {
- }
- };
- HashMap<String, String> mData = new HashMap<String, String>();
- mData.put("instCd", BuildConfig.INST_CD);
- mData.put("srchDd", getDate());
- mData.put("ordDeptCd", deptCd);
- if (Common.checkNetwork(mContext) == true) {
- Common.callHttp(mContext, ConsentConfig.GET_DOCTOR_LIST, mData, callBack);
- } else {
- instance.dismissProgress();
- Common.networkErrorAlert(mActivity);
- }
- }
- private void setSpinnerAdapter(final ArrayList arrayList, final String apiType) {
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- deptSpinnerAdapter = new DeptSpinnerAdapter(mActivity, arrayList, apiType);
- if (apiType.equals(ConsentConfig.GET_WARD_LIST)) {
- instance.wardSpinner.setAdapter(deptSpinnerAdapter);
- instance.wardSpinner.setOnItemSelectedListener(onItemSelectedListener);
- for (int i = 0; i < arrayList.size(); i++) {
- DeptListVO deptListVO = (DeptListVO) arrayList.get(i);
- String _deptCd = deptListVO.getDeptCd();
- if (instance.deptCd.equals(_deptCd)) {
- instance.wardSpinner.setSelection(i);
- }
- }
- } else if (apiType.equals(ConsentConfig.GET_DEPT_LIST)) {
- instance.deptSpinner.setAdapter(deptSpinnerAdapter);
- instance.deptSpinner.setOnItemSelectedListener(onItemSelectedListener);
- for (int i = 0; i < arrayList.size(); i++) {
- DeptListVO deptListVO = (DeptListVO) arrayList.get(i);
- String _deptCd = deptListVO.getDeptCd();
- if (instance.deptCd.equals(_deptCd)) {
- instance.deptSpinner.setSelection(i);
- }
- }
- } else if (apiType.equals(ConsentConfig.GET_DOCTOR_LIST)) {
- instance.dismissProgress();
- instance.doctorSpinner.setAdapter(deptSpinnerAdapter);
- instance.doctorSpinner.setOnItemSelectedListener(onItemSelectedListener);
- for (int i = 0; i < arrayList.size(); i++) {
- DoctorListVO doctorListVO = (DoctorListVO) arrayList.get(i);
- String _doctorId = doctorListVO.getDoctorId();
- if (instance.userId.equals(_doctorId)) {
- instance.doctorSpinner.setSelection(i);
- }
- }
- }
- }
- });
- }
- private Spinner.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
- DeptListVO deptListVO = null;
- DoctorListVO doctorListVO = null;
- String deptCd = "";
- String deptNm = "";
- String doctorId = "";
- String drKind = "";
- if (parent != instance.doctorSpinner) {
- deptListVO = (DeptListVO) parent.getAdapter().getItem(position);
- deptCd = deptListVO.getDeptCd();
- deptNm = deptListVO.getDeptNm();
- }
- if (parent == instance.wardSpinner) {
- patientSearchMap.put("wardCd", deptCd);
- } else if (parent == instance.deptSpinner) {
- Log.e(TAG, "deptCd -- > " + deptCd);
- Log.e(TAG, "deptNm -- > " + deptNm);
- if (!deptCd.equals("")) {
- instance.showProgress();
- getDoctorList(deptCd);
- } else {
- ArrayList<DoctorListVO> arrayList = new ArrayList<DoctorListVO>();
- arrayList.add(new DoctorListVO("", mContext.getString(R.string.deptListEmpty), "", ""));
- setSpinnerAdapter(arrayList, ConsentConfig.GET_DOCTOR_LIST);
- }
- patientSearchMap.put("ordDeptCd", deptCd);
- } else if (parent == instance.doctorSpinner) {
- doctorListVO = (DoctorListVO) parent.getAdapter().getItem(position);
- doctorId = doctorListVO.getDoctorId();
- drKind = doctorListVO.getDrKind();
- patientSearchMap.put("doctorId", doctorId);
- patientSearchMap.put("drKind", drKind);
- }
- }
- @Override
- public void onNothingSelected(AdapterView<?> parent) {
- }
- };
- // /**
- // * 로그인시 사용자 정보로 환자 리스트를 최초 처음만 조회해준다
- // */
- // public void getInitPatientList() {
- // CallBack callBack = new CallBack() {
- // @Override
- // public void result(String result) {
- // instance.dismissProgress();
- // Log.e(TAG, "result -- > " + result);
- // ArrayList<HashMap<String, String>> arrayList = Common.parseJSON(mContext, result);
- // String code = arrayList.get(0).get("code");
- //
- // if (!code.equals("00")) {
- // stop();
- // } else {
- // ArrayList<PatientListVO> dataAr = ParseJsonData.getInstance(mContext).getPatientList(arrayList);
- // if (dataAr.size() > 0) {
- // setPatientListAdapter(dataAr);
- // }
- // }
- // }
- //
- // @Override
- // public void stop() {
- // instance.dismissProgress();
- // }
- //
- // @Override
- // public void error() {
- //
- // }
- // };
- //
- // String instCd = BuildConfig.INST_CD;
- // String pid = "";
- // String srchDd = getDate();
- // String doctorId = Common.getStringPreference(mContext, "userInfo", "userId");
- // String ordDeptCd = Common.getStringPreference(mContext, "userInfo", "deptCd");
- // String userId = Common.getStringPreference(mContext, "userInfo", "userId");
- // String myPatient = "N";
- // String drKind = Common.getStringPreference(mContext, "userInfo", "drKind");
- // String patientState = this.patientState;
- // String wardCd = "";
- // String jobKindCd = Common.getStringPreference(mContext, "userInfo", "jobKindCd");
- // String selectFlag = instance.indexPage;
- // String srchYn = instance.indexPage.equals("SR") ? "Y" : "N";
- //
- // if (jobKindCd.indexOf("03") == 0) {
- //
- // } else {
- // if (selectFlag.equals("I")) {
- // wardCd = Common.getStringPreference(mContext, "userInfo", "deptCd");
- // }
- // }
- //
- // HashMap<String, String> mData = new HashMap<String, String>();
- // mData.put("srchDd", srchDd);
- // mData.put("ordDeptCd", ordDeptCd);
- // mData.put("doctorId", doctorId);
- // mData.put("pid", pid);
- // mData.put("patientState", patientState);
- // mData.put("instCd", instCd);
- // mData.put("wardCd", wardCd);
- // mData.put("userId", userId);
- // mData.put("myPatient", myPatient);
- // mData.put("jobKindCd", jobKindCd);
- // mData.put("drKind", drKind);
- // mData.put("selectFlag", selectFlag);
- // mData.put("srchYn", srchYn);
- //
- // if (Common.checkNetwork(mContext) == true) {
- // instance.showProgress();
- // Common.callHttp(mContext, ConsentConfig.GET_PATIENT_LIST, mData, callBack);
- // } else {
- // instance.dismissProgress();
- // Common.networkErrorAlert(mActivity);
- // }
- // }
- public void getPatientList() {
- boolean emptyData = false;
- String wardCd = patientSearchMap.get("wardCd") == null ? "" : patientSearchMap.get("wardCd");
- String deptCd = patientSearchMap.get("ordDeptCd") == null ? "" : patientSearchMap.get("ordDeptCd");
- String myPatient = instance.chkMyPatient.isChecked() == true ? "Y" : "N";
- String message = "";
- if (instance.indexPage.equals("I")) {
- if (wardCd.equals("") && deptCd.equals("") && instance.etPatientId.getText().toString().trim().equals("")) {
- emptyData = true;
- message = mContext.getString(R.string.inPateintSearchEmptyData);
- }
- } else if (instance.indexPage.equals("O")) {
- if (deptCd.equals("") && instance.etPatientId.getText().toString().trim().equals("")) {
- emptyData = true;
- message = mContext.getString(R.string.patientsearchEmptyData);
- }
- } else if (instance.indexPage.equals("SR")) {
- String pidStr = instance.etPatientId.getText().toString();
- if (pidStr.equals("")) {
- emptyData = true;
- message = mContext.getString(R.string.emptyPatientId);
- }
- }
- if (emptyData == true) {
- instance.showSingButtonDialog(message);
- return;
- }
- CallBack callBack = new CallBack() {
- private ArrayList<PatientListVO> patientArr = new ArrayList<PatientListVO>();
- @Override
- public void result(String result) {
- Log.e(TAG, "patientList -- > " + result);
- ArrayList<HashMap<String, String>> arrayList = Common.parseJSON(mContext, result);
- String code = arrayList.get(0).get("code");
- if (!code.equals("00")) {
- stop();
- } else {
- patientArr = ParseJsonData.getInstance(mContext).getPatientList(arrayList);
- setPatientListAdapter(patientArr);
- }
- }
- @Override
- public void stop() {
- instance.dismissProgress();
- if (patientListAdapter != null) {
- patientArr.clear();
- setPatientListAdapter(patientArr);
- }
- }
- @Override
- public void error() {
- }
- };
- String srchYn = "N";
- if (instance.indexPage.equals("SR")) {
- srchYn = "Y";
- }
- patientSearchMap.put("srchDd", getDate());
- patientSearchMap.put("pid", instance.etPatientId.getText().toString().trim());
- patientSearchMap.put("patientState", patientState);
- patientSearchMap.put("instCd", BuildConfig.INST_CD);
- patientSearchMap.put("userId", instance.userId);
- patientSearchMap.put("myPatient", myPatient);
- patientSearchMap.put("jobKindCd", instance.jobKindCd);
- patientSearchMap.put("selectFlag", instance.indexPage);
- patientSearchMap.put("srchYn", srchYn);
- Log.e(TAG, "patientSearchMap -- > " + patientSearchMap);
- if (Common.checkNetwork(mContext) == true) {
- instance.showProgress();
- Common.callHttp(mContext, ConsentConfig.GET_PATIENT_LIST, patientSearchMap, callBack);
- } else {
- instance.dismissProgress();
- Common.networkErrorAlert(mActivity);
- }
- }
- private void setPatientListAdapter(final ArrayList<PatientListVO> arrayList) {
- mActivity.runOnUiThread(
- new Runnable() {
- @Override
- public void run() {
- instance.dismissProgress();
- instance.centerMenu.clearPatientInfo();
- if (arrayList.size() == 0) {
- instance.patientEmpty.setVisibility(View.VISIBLE);
- } else {
- instance.patientEmpty.setVisibility(View.GONE);
- }
- if (patientListAdapter == null) {
- linearLayoutManager = new LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false);
- instance.patientRecyclerView.setLayoutManager(linearLayoutManager);
- patientListAdapter = new PatientListAdapter(mActivity, mContext, arrayList, instance.indexPage);
- instance.patientRecyclerView.setAdapter(patientListAdapter);
- } else {
- patientListAdapter.arrayList.clear();
- patientListAdapter.arrayList = arrayList;
- patientListAdapter.click = false;
- patientListAdapter.notifyDataSetChanged();
- }
- }
- });
- }
- }
|