|
@@ -2,6 +2,8 @@ package com.wdkl.callingmainnurse.ui.fragment;
|
|
|
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.Nullable;
|
|
|
|
+import android.support.v4.widget.SwipeRefreshLayout;
|
|
|
|
+import android.support.v7.widget.GridLayoutManager;
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
@@ -16,6 +18,8 @@ import com.google.gson.Gson;
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.wdkl.callingmainnurse.R;
|
|
import com.wdkl.callingmainnurse.R;
|
|
import com.wdkl.callingmainnurse.adapter.DoctorHostAdapter;
|
|
import com.wdkl.callingmainnurse.adapter.DoctorHostAdapter;
|
|
|
|
+import com.wdkl.callingmainnurse.adapter.DutyDoctorAdapter;
|
|
|
|
+import com.wdkl.callingmainnurse.adapter.DutyNurseAdapter;
|
|
import com.wdkl.callingmainnurse.adapter.MedicalHostsCallingQueuingInfoAdapter;
|
|
import com.wdkl.callingmainnurse.adapter.MedicalHostsCallingQueuingInfoAdapter;
|
|
import com.wdkl.callingmainnurse.adapter.NurseHostAdapter;
|
|
import com.wdkl.callingmainnurse.adapter.NurseHostAdapter;
|
|
import com.wdkl.callingmainnurse.base.BaseFragment;
|
|
import com.wdkl.callingmainnurse.base.BaseFragment;
|
|
@@ -36,6 +40,7 @@ import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
import butterknife.Bind;
|
|
import butterknife.Bind;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.ButterKnife;
|
|
@@ -51,10 +56,22 @@ import static com.wdkl.callingmainnurse.util.ToastUtil.showToast;
|
|
|
|
|
|
public class CallingHostFragment extends BaseFragment implements DoctorHostAdapter.DoctorHostItemOnclickListener,
|
|
public class CallingHostFragment extends BaseFragment implements DoctorHostAdapter.DoctorHostItemOnclickListener,
|
|
NurseHostAdapter.NurseHostItemOnclickListener, View.OnClickListener,
|
|
NurseHostAdapter.NurseHostItemOnclickListener, View.OnClickListener,
|
|
- MedicalHostsCallingQueuingInfoAdapter.CallingQueuingBarItemOnClickListener, RecyclerView.OnItemTouchListener {
|
|
|
|
|
|
+ MedicalHostsCallingQueuingInfoAdapter.CallingQueuingBarItemOnClickListener, RecyclerView.OnItemTouchListener, SwipeRefreshLayout.OnRefreshListener {
|
|
|
|
|
|
private View mView;
|
|
private View mView;
|
|
|
|
|
|
|
|
+ //刷新控件
|
|
|
|
+ @Bind(R.id.fragment_calling_nurse_layout_sr_refresh)
|
|
|
|
+ SwipeRefreshLayout swipeNurseRefreshLayout;
|
|
|
|
+
|
|
|
|
+ //值班医生
|
|
|
|
+ @Bind(R.id.fragment_rv_doctors)
|
|
|
|
+ RecyclerView rvDutyDoctors;
|
|
|
|
+
|
|
|
|
+ //值班护士
|
|
|
|
+ @Bind(R.id.fragment_rv_nurses)
|
|
|
|
+ RecyclerView rvDutyNurses;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 医生主机RV
|
|
* 医生主机RV
|
|
*/
|
|
*/
|
|
@@ -72,7 +89,7 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
/**
|
|
/**
|
|
* 护士主机RV
|
|
* 护士主机RV
|
|
*/
|
|
*/
|
|
- @Bind(R.id.fragment_rv_nurse)
|
|
|
|
|
|
+ @Bind(R.id.fragment_rv_nurse_host)
|
|
RecyclerView rvNurse;
|
|
RecyclerView rvNurse;
|
|
/**
|
|
/**
|
|
* 护士主机的实体
|
|
* 护士主机的实体
|
|
@@ -127,6 +144,11 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
@Bind(R.id.fragment_tv_doctor_nurse_no)
|
|
@Bind(R.id.fragment_tv_doctor_nurse_no)
|
|
TextView nurse_CallStaus;
|
|
TextView nurse_CallStaus;
|
|
|
|
|
|
|
|
+ private ArrayList<String> dutyDoctorsList = new ArrayList<>();
|
|
|
|
+ private ArrayList<String> dutyNursesList = new ArrayList<>();
|
|
|
|
+ private DutyDoctorAdapter dutyDoctorAdapter;
|
|
|
|
+ private DutyNurseAdapter dutyNurseAdapter;
|
|
|
|
+
|
|
@Nullable
|
|
@Nullable
|
|
@Override
|
|
@Override
|
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
@@ -152,6 +174,7 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
ivEndCalling.setOnClickListener(this);
|
|
ivEndCalling.setOnClickListener(this);
|
|
rvDoctor.addOnItemTouchListener(this);
|
|
rvDoctor.addOnItemTouchListener(this);
|
|
rvNurse.addOnItemTouchListener(this);
|
|
rvNurse.addOnItemTouchListener(this);
|
|
|
|
+ swipeNurseRefreshLayout.setOnRefreshListener(this);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -184,15 +207,30 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
rvDoctor.setAdapter(doctorHostAdapter);
|
|
rvDoctor.setAdapter(doctorHostAdapter);
|
|
doctorHostAdapter.setDoctorHostItemOnclickListener(this);
|
|
doctorHostAdapter.setDoctorHostItemOnclickListener(this);
|
|
|
|
|
|
- LinearLayoutManager nurseManager = new LinearLayoutManager(getActivity());
|
|
|
|
- nurseManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
|
|
|
+ //护士主机列表
|
|
|
|
+ //LinearLayoutManager nurseManager = new LinearLayoutManager(getActivity());
|
|
|
|
+ //nurseManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
|
+ GridLayoutManager nurseManager = new GridLayoutManager(getActivity(), 4);
|
|
rvNurse.setLayoutManager(nurseManager);
|
|
rvNurse.setLayoutManager(nurseManager);
|
|
nurseHostAdapter = new NurseHostAdapter(getActivity(), nurseHostList);
|
|
nurseHostAdapter = new NurseHostAdapter(getActivity(), nurseHostList);
|
|
rvNurse.setAdapter(nurseHostAdapter);
|
|
rvNurse.setAdapter(nurseHostAdapter);
|
|
nurseHostAdapter.setNurseHostItemOnclickListener(this);
|
|
nurseHostAdapter.setNurseHostItemOnclickListener(this);
|
|
|
|
|
|
- getNurseHostList();
|
|
|
|
- getDoctorHostList();
|
|
|
|
|
|
+ //责任医生列表
|
|
|
|
+ GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 3);
|
|
|
|
+ rvDutyDoctors.setLayoutManager(layoutManager);
|
|
|
|
+ dutyDoctorAdapter = new DutyDoctorAdapter(getActivity(), dutyDoctorsList);
|
|
|
|
+ rvDutyDoctors.setAdapter(dutyDoctorAdapter);
|
|
|
|
+
|
|
|
|
+ //责任护士列表
|
|
|
|
+ GridLayoutManager layoutManager2 = new GridLayoutManager(getActivity(), 3);
|
|
|
|
+ rvDutyNurses.setLayoutManager(layoutManager2);
|
|
|
|
+ dutyNurseAdapter = new DutyNurseAdapter(getActivity(), dutyNursesList);
|
|
|
|
+ rvDutyNurses.setAdapter(dutyNurseAdapter);
|
|
|
|
+
|
|
|
|
+ //getNurseHostList();
|
|
|
|
+ getNurseHostTestData();
|
|
|
|
+ //getDoctorHostList();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -215,6 +253,49 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
//getCallQueuingList();
|
|
//getCallQueuingList();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void onRefresh() {
|
|
|
|
+ resetRightList();
|
|
|
|
+ //getNurseHostList();
|
|
|
|
+ getNurseHostTestData();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getNurseHostTestData() {
|
|
|
|
+ ArrayList<String> dutyDoctors = new ArrayList<>();
|
|
|
|
+ dutyDoctors.add("刘医生");
|
|
|
|
+ dutyDoctors.add("张医生");
|
|
|
|
+ ArrayList<String> dutyNurses = new ArrayList<>();
|
|
|
|
+ dutyNurses.add("王护士");
|
|
|
|
+ dutyNurses.add("李护士");
|
|
|
|
+ nurseHostList.clear();
|
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
|
+ NurseHostListInfo nurseHostListInfo = new NurseHostListInfo();
|
|
|
|
+ nurseHostListInfo.setDepartment("内一科");
|
|
|
|
+ nurseHostListInfo.setDeviceName("护士主机" + i);
|
|
|
|
+ nurseHostListInfo.setDeviceSipIp("192.168.1.11");
|
|
|
|
+ nurseHostListInfo.setDeviceSipId("111");
|
|
|
|
+ nurseHostListInfo.setDutyDoctorList(dutyDoctors);
|
|
|
|
+ nurseHostListInfo.setNurseOnDutyList(dutyNurses);
|
|
|
|
+ nurseHostList.add(nurseHostListInfo);
|
|
|
|
+ }
|
|
|
|
+ nurseHostAdapter.updateList(nurseHostList);
|
|
|
|
+
|
|
|
|
+ if (swipeNurseRefreshLayout.isRefreshing()) {
|
|
|
|
+ swipeNurseRefreshLayout.setRefreshing(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void resetRightList() {
|
|
|
|
+ tvCallingTips.setText("");
|
|
|
|
+ nurse_CallStaus.setText("--");
|
|
|
|
+ ivDoctorOrNurseCalling.setImageResource(R.mipmap.ic_trusteeship_n);
|
|
|
|
+ ivEndCalling.setVisibility(View.GONE);
|
|
|
|
+ rlIncall.setVisibility(View.VISIBLE);
|
|
|
|
+ rlNotInCallBg.setVisibility(View.GONE);
|
|
|
|
+ dutyDoctorAdapter.clear();
|
|
|
|
+ dutyNurseAdapter.clear();
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取医生主机列表信息
|
|
* 获取医生主机列表信息
|
|
*/
|
|
*/
|
|
@@ -263,26 +344,40 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
.execute(new StringCallback() {
|
|
.execute(new StringCallback() {
|
|
@Override
|
|
@Override
|
|
public void onError(Call call, Exception e, int id) {
|
|
public void onError(Call call, Exception e, int id) {
|
|
|
|
+ if (swipeNurseRefreshLayout.isRefreshing()) {
|
|
|
|
+ swipeNurseRefreshLayout.setRefreshing(false);
|
|
|
|
+ }
|
|
hideProgress();
|
|
hideProgress();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onResponse(String response, int id) {
|
|
public void onResponse(String response, int id) {
|
|
- if (notEmpty(response)) {
|
|
|
|
- LogUtil.d(CallingHostFragment.class, "NurseHostListresponse==" + response);
|
|
|
|
- String code = getStringData(response, "Code");
|
|
|
|
- if (code.equals("OK!")) {
|
|
|
|
- nurseHostList = new Gson().fromJson(getStringData(response, "hostList"), new TypeToken<ArrayList<NurseHostListInfo>>() {
|
|
|
|
- }.getType());
|
|
|
|
- if (null != nurseHostList) {
|
|
|
|
- LogUtil.d(CallingHostFragment.class, "nurseHostListsize==" + nurseHostList.size());
|
|
|
|
- nurseHostAdapter.updateList(nurseHostList);
|
|
|
|
|
|
+ if (swipeNurseRefreshLayout.isRefreshing()) {
|
|
|
|
+ swipeNurseRefreshLayout.setRefreshing(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ if (notEmpty(response)) {
|
|
|
|
+ LogUtil.d(CallingHostFragment.class, "NurseHostListresponse==" + response);
|
|
|
|
+ String code = getStringData(response, "Code");
|
|
|
|
+ if (code.equals("OK!")) {
|
|
|
|
+ nurseHostList = new Gson().fromJson(getStringData(response, "hostList"), new TypeToken<ArrayList<NurseHostListInfo>>() {
|
|
|
|
+ }.getType());
|
|
|
|
+ if (null != nurseHostList) {
|
|
|
|
+ LogUtil.d(CallingHostFragment.class, "nurseHostListsize==" + nurseHostList.size());
|
|
|
|
+ nurseHostAdapter.updateList(nurseHostList);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ LogUtil.i(CallingHostFragment.class, "Code==" + code + "---数据返回错误!");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- LogUtil.i(CallingHostFragment.class, "Code==" + code + "---数据返回错误!");
|
|
|
|
|
|
+ LogUtil.i(CallingHostFragment.class, "数据返回为空!");
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- LogUtil.i(CallingHostFragment.class, "数据返回为空!");
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ if (swipeNurseRefreshLayout.isRefreshing()) {
|
|
|
|
+ swipeNurseRefreshLayout.setRefreshing(false);
|
|
|
|
+ }
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -354,25 +449,29 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
|
|
public void nurseHostItemOnclick(View view, int position) {
|
|
public void nurseHostItemOnclick(View view, int position) {
|
|
if (null == nurseHostList || nurseHostList.size() <= 0 || null == nurseHostList.get(position))
|
|
if (null == nurseHostList || nurseHostList.size() <= 0 || null == nurseHostList.get(position))
|
|
return;
|
|
return;
|
|
- if (nurseHostList.get(position).isChecked()) {
|
|
|
|
- nurseHostList.get(position).setChecked(false);
|
|
|
|
- rlIncall.setVisibility(View.GONE);
|
|
|
|
- rlNotInCallBg.setVisibility(View.VISIBLE);
|
|
|
|
- tvCallingTips.setText("");
|
|
|
|
|
|
+ NurseHostListInfo info = nurseHostList.get(position);
|
|
|
|
+ if (info.isChecked()) {
|
|
|
|
+ //nurseHostList.get(position).setChecked(false);
|
|
|
|
+ //rlIncall.setVisibility(View.GONE);
|
|
|
|
+ //rlNotInCallBg.setVisibility(View.VISIBLE);
|
|
|
|
+ //tvCallingTips.setText("");
|
|
} else {
|
|
} else {
|
|
for (NurseHostListInfo entity : nurseHostList) {
|
|
for (NurseHostListInfo entity : nurseHostList) {
|
|
if (null == entity) continue;
|
|
if (null == entity) continue;
|
|
entity.setChecked(false);
|
|
entity.setChecked(false);
|
|
}
|
|
}
|
|
- nurseHostList.get(position).setChecked(true);
|
|
|
|
- tvCallingTips.setText(nurseHostList.get(position).getDeviceName());
|
|
|
|
- nurse_CallStaus.setText(nurseHostList.get(position).getDeviceName());
|
|
|
|
|
|
+ info.setChecked(true);
|
|
|
|
+ tvCallingTips.setText(info.getDeviceName());
|
|
|
|
+ nurse_CallStaus.setText(info.getDeviceName());
|
|
ivDoctorOrNurseCalling.setImageResource(R.mipmap.ic_nurse_right_in_call);
|
|
ivDoctorOrNurseCalling.setImageResource(R.mipmap.ic_nurse_right_in_call);
|
|
ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
|
|
|
|
+ ivEndCalling.setVisibility(View.VISIBLE);
|
|
rlIncall.setVisibility(View.VISIBLE);
|
|
rlIncall.setVisibility(View.VISIBLE);
|
|
rlNotInCallBg.setVisibility(View.GONE);
|
|
rlNotInCallBg.setVisibility(View.GONE);
|
|
}
|
|
}
|
|
nurseHostAdapter.notifyDataSetChanged();
|
|
nurseHostAdapter.notifyDataSetChanged();
|
|
|
|
+ dutyDoctorAdapter.updateList(info.getDutyDoctorList());
|
|
|
|
+ dutyNurseAdapter.updateList(info.getNurseOnDutyList());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|