Prechádzať zdrojové kódy

和医生主机的代码逻辑配套

wanggong 5 rokov pred
rodič
commit
63afe9328f
24 zmenil súbory, kde vykonal 705 pridanie a 71 odobranie
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. BIN
      .idea/caches/gradle_models.ser
  3. 4 0
      .idea/encodings.xml
  4. 9 0
      .idea/misc.xml
  5. 12 0
      .idea/modules.xml
  6. 12 0
      .idea/runConfigurations.xml
  7. 6 0
      .idea/vcs.xml
  8. 1 1
      app/build.gradle
  9. 6 0
      app/src/main/java/com/wdkl/callingmainnurse/MyApplication.java
  10. 2 2
      app/src/main/java/com/wdkl/callingmainnurse/adapter/CallListAdapter.java
  11. 2 0
      app/src/main/java/com/wdkl/callingmainnurse/adapter/DoctorHostAdapter.java
  12. 7 1
      app/src/main/java/com/wdkl/callingmainnurse/common/Constants.java
  13. 62 0
      app/src/main/java/com/wdkl/callingmainnurse/entity/AllDoctorHostEntity.java
  14. 33 0
      app/src/main/java/com/wdkl/callingmainnurse/entity/CallListEntity.java
  15. 2 1
      app/src/main/java/com/wdkl/callingmainnurse/ui/activity/InitActivity.java
  16. 1 0
      app/src/main/java/com/wdkl/callingmainnurse/ui/activity/MainFragmentActivity.java
  17. 123 8
      app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/CallingBedFragment.java
  18. 237 18
      app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/CallingHostFragment.java
  19. 39 4
      app/src/main/java/com/wdkl/callingmainnurse/util/AnalysisUdpUtil.java
  20. 61 0
      app/src/main/java/com/wdkl/callingmainnurse/util/UdpSendUtil.java
  21. 0 1
      app/src/main/res/layout/activity_main_sideslip_popu_window.xml
  22. 16 4
      app/src/main/res/layout/fragment_calling_doctor_medica_hosts.xml
  23. 70 31
      app/src/main/res/layout/fragment_medical_hosts_call_queuing_info_bar_layout.xml
  24. BIN
      app/src/main/res/raw/doctor_host.mp3

BIN
.idea/caches/build_file_checksums.ser


BIN
.idea/caches/gradle_models.ser


+ 4 - 0
.idea/encodings.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" addBOMForNewFiles="with NO BOM" />
+</project>

+ 9 - 0
.idea/misc.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/build/classes" />
+  </component>
+  <component name="ProjectType">
+    <option name="id" value="Android" />
+  </component>
+</project>

+ 12 - 0
.idea/modules.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/AmDemo_R/AmDemo_R.iml" filepath="$PROJECT_DIR$/AmDemo_R/AmDemo_R.iml" />
+      <module fileurl="file://$PROJECT_DIR$/CallingMainNurse_center2.iml" filepath="$PROJECT_DIR$/CallingMainNurse_center2.iml" />
+      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
+      <module fileurl="file://$PROJECT_DIR$/nurseMainLib/nurseMainLib.iml" filepath="$PROJECT_DIR$/nurseMainLib/nurseMainLib.iml" />
+      <module fileurl="file://$PROJECT_DIR$/test/test.iml" filepath="$PROJECT_DIR$/test/test.iml" />
+    </modules>
+  </component>
+</project>

+ 12 - 0
.idea/runConfigurations.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

+ 1 - 1
app/build.gradle

@@ -24,7 +24,7 @@ android {
         minSdkVersion 15
         targetSdkVersion 26
         versionCode 1
-        versionName "1.32"
+        versionName "1.0"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
         multiDexEnabled true
 

+ 6 - 0
app/src/main/java/com/wdkl/callingmainnurse/MyApplication.java

@@ -8,6 +8,7 @@ import android.content.ServiceConnection;
 import android.net.wifi.WifiManager;
 import android.os.IBinder;
 
+import com.wdkl.callingmainnurse.entity.AllDoctorHostEntity;
 import com.wdkl.callingmainnurse.entity.UdpEntity;
 import com.wdkl.callingmainnurse.service.APPService;
 import com.wdkl.callingmainnurse.util.ScreenExtinguishUtil;
@@ -16,6 +17,7 @@ import com.wdkl.callingmainnurse.util.anrfcutil.AnrFcExceptionUtil;
 import com.zhy.http.okhttp.OkHttpUtils;
 
 import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import okhttp3.ConnectionPool;
@@ -72,6 +74,9 @@ public class MyApplication extends Application {
         sAppContext = getAppContext();
     }
 
+    //全局医生列表
+    public static List<AllDoctorHostEntity.DoctorHost> AllDoctorHostList;
+
     private void initUdp() {
         wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
         helper = new UdpHelper(wifiManager, sAppContext);
@@ -101,6 +106,7 @@ public class MyApplication extends Application {
 
         sAppContext = getApplicationContext();
         callEntityList = new ArrayList<>();
+        AllDoctorHostList = new ArrayList<>();
         initUdp();
         initClient();
 

+ 2 - 2
app/src/main/java/com/wdkl/callingmainnurse/adapter/CallListAdapter.java

@@ -107,12 +107,12 @@ public class CallListAdapter extends RecyclerView.Adapter<CallListAdapter.MyView
                 holder.tvRoomNum.setText(list.get(position).getRoomNumber());
                 holder.tvName.setText(" 紧急呼叫 ");
                 break;
-            case Constants.MANAGER_CALL:
+            case Constants.DOCTOR_CALL:
                 holder.llBed.setVisibility(View.GONE);
                 holder.llRoom.setVisibility(View.VISIBLE);
 
                 holder.ivLogo.setImageResource(R.mipmap.ic_manager);
-                holder.tvRoomNum.setText("总控制室");
+                holder.tvRoomNum.setText("医生主机");
                 holder.tvName.setText(" 呼叫 ");
                 holder.tvRoomNumTail.setVisibility(View.GONE);
                 break;

+ 2 - 0
app/src/main/java/com/wdkl/callingmainnurse/adapter/DoctorHostAdapter.java

@@ -9,9 +9,11 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.wdkl.callingmainnurse.R;
+import com.wdkl.callingmainnurse.entity.AllDoctorHostEntity;
 import com.wdkl.callingmainnurse.entity.DoctorHostEntity;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import butterknife.Bind;
 import butterknife.ButterKnife;

+ 7 - 1
app/src/main/java/com/wdkl/callingmainnurse/common/Constants.java

@@ -213,7 +213,7 @@ public class Constants {
 
     /**
      * 各种呼叫的机型
-     * type : 1门口机 2主机 3 子机  4请求增援 5卫生间 6总控机 优先等级依次升高   12传统机
+     * type : 1门口机 2主机 3 子机  4请求增援 5卫生间 6总控机 7医生机 8护士主机转接给医生机  优先等级依次升高   12传统机
      */
     public static final String DOOR_CALL = "1";
     public static final String MAIN_CALL = "2";
@@ -221,7 +221,13 @@ public class Constants {
     public static final String ROOMHELP_CALL = "4";
     public static final String WSHROOM_CALL = "5";
     public static final String MANAGER_CALL = "6";
+    public static final String DOCTOR_CALL = "7";
+    public static final String MUlTITAP_CALL = "8";
     public static final String TRADITION_CALL = "12";
+    public static String CallType = "";
+    public static String DoctorMachineCallStatus = "";//医生主机呼叫护士主机的状态
+    //呼叫医生主机id
+    public static String CALLING_HOST_ID = "";
 
     public static String MYSELF_ID = "";//自己的机器ID
     public static String CALLMAIN_ID = "";//所属主机机器ID

+ 62 - 0
app/src/main/java/com/wdkl/callingmainnurse/entity/AllDoctorHostEntity.java

@@ -0,0 +1,62 @@
+package com.wdkl.callingmainnurse.entity;
+
+import java.util.List;
+
+public class AllDoctorHostEntity {
+
+    private List<DoctorHost> PartInfoArray;
+
+
+
+    public List<DoctorHost> getPartInfoArray() {
+        return PartInfoArray;
+    }
+
+    public void setPartInfoArray(List<DoctorHost> DoctorHostArray) {
+        this.PartInfoArray = DoctorHostArray;
+    }
+
+  public class DoctorHost{
+      //護士id
+      private String ID;
+      //
+      private String PART_HOSPITALNAME;
+      //科室名称
+      private String PART_NAME;
+      //是否选中
+      public boolean isChecked;
+
+      public String getID() {
+          return ID;
+      }
+
+      public void setID(String ID) {
+          this.ID = ID;
+      }
+
+      public String getPART_HOSPITALNAME() {
+          return PART_HOSPITALNAME;
+      }
+
+      public void setPART_HOSPITALNAME(String PART_HOSPITALNAME) {
+          this.PART_HOSPITALNAME = PART_HOSPITALNAME;
+      }
+
+      public String getPART_NAME() {
+          return PART_NAME;
+      }
+
+      public void setPART_NAME(String PART_NAME) {
+          this.PART_NAME = PART_NAME;
+      }
+
+      public boolean isChecked() {
+          return isChecked;
+      }
+
+      public void setChecked(boolean checked) {
+          isChecked = checked;
+      }
+  }
+
+}

+ 33 - 0
app/src/main/java/com/wdkl/callingmainnurse/entity/CallListEntity.java

@@ -0,0 +1,33 @@
+package com.wdkl.callingmainnurse.entity;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class CallListEntity implements Serializable {
+
+    public List<UdpEntity> udpEntitys;
+
+    public List<UdpEntity> getPartInfoArray() {
+        return udpEntitys;
+    }
+
+
+    private UdpEntity udpEntity;
+    private Long time;
+
+    public Long getTime() {
+        return time;
+    }
+
+    public void setTime(Long time) {
+        this.time = time;
+    }
+
+    public UdpEntity getUdpEntity() {
+        return udpEntity;
+    }
+
+    public void setUdpEntity(UdpEntity udpEntity) {
+        this.udpEntity = udpEntity;
+    }
+}

+ 2 - 1
app/src/main/java/com/wdkl/callingmainnurse/ui/activity/InitActivity.java

@@ -54,6 +54,7 @@ import static com.wdkl.callingmainnurse.MyApplication.serialPortUtil;
 
 public class InitActivity extends BaseActivity implements SerialPortUtil.IForBroadcastClick , SerialPortUtil.ISerialPortBedOnclickString{
 
+    private String TAG = InitActivity.class.getSimpleName();
     public static final int RESTART_SYSTEM = 2008;
     public static final int ETHRESTART_SYSTEM = 2009; //wuyq add
 
@@ -274,7 +275,7 @@ public class InitActivity extends BaseActivity implements SerialPortUtil.IForBro
                                         Gson gson = new Gson();
                                         InitDataEntity initDataEntity = gson.fromJson(data, InitDataEntity.class);
                                         saveData(initDataEntity);
-
+                                        Log.e(TAG,"自己机器ID "+initDataEntity.getId());
                                         AutoRebootUtil.rebootContinueCounts(InitActivity.this, 0);//重启标识复位
 
                                         Intent intent = new Intent();

+ 1 - 0
app/src/main/java/com/wdkl/callingmainnurse/ui/activity/MainFragmentActivity.java

@@ -867,6 +867,7 @@ public class MainFragmentActivity extends FragmentActivity implements IVvsipServ
         switch (call.mState) {
             case 0://正在呼叫中:子机自动接通 isIncomingCall() = true  mState = 0
                 Constants.CALL_STATE = Constants.IN_CALL;
+                SipHelperUtil.getInstance(this).getmSipCallBackI().autoTalking();
                 EventBus.getDefault().post(new MessageEvent(call, Constants.EVENT_SIP));
                 break;
             case 1:

+ 123 - 8
app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/CallingBedFragment.java

@@ -33,6 +33,7 @@ import com.wdkl.callingmainnurse.adapter.SicknessRoomAdapter;
 import com.wdkl.callingmainnurse.adapter.VoiceMessageAdapter;
 import com.wdkl.callingmainnurse.base.BaseFragment;
 import com.wdkl.callingmainnurse.common.Constants;
+import com.wdkl.callingmainnurse.entity.CallListEntity;
 import com.wdkl.callingmainnurse.entity.CallingQueuingInfoEntity;
 import com.wdkl.callingmainnurse.entity.HospitalInfoEntity;
 import com.wdkl.callingmainnurse.entity.InitDataEntity;
@@ -66,6 +67,8 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 
 import butterknife.Bind;
 import butterknife.ButterKnife;
@@ -90,6 +93,10 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
         SicknessRoomAdapter.CallingSicknessRoomItemOnclickListener, CallListAdapter.CallingListItemOnclickListener,
         SerialPortUtil.ISerialPortOnclickEvent, SerialPortUtil.IForkSpringSwiData, CallingQueuingInfoAdapter.CallingQueuingItemOnclickListener
         , SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {
+
+
+
+    private String TAG = CallingBedFragment.class.getSimpleName();
     private View mView;
 
     /**
@@ -414,6 +421,11 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
 
     public static CallingBedFragment mCallingBedFragment;
 
+    private CallATimeoutThread callATimeoutThread;
+    private List<CallListEntity> callListEntityList;
+    private boolean threadBool = true;//30秒无人接听线程
+    private boolean  transmitThreadBool = true;//是否转发给医生机
+
     public static CallingBedFragment getInstance() {
         return mCallingBedFragment == null ? new CallingBedFragment() : mCallingBedFragment;
     }
@@ -530,9 +542,14 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
         //初始化排队信息栏数据
         initCallingQueuingInfo();
         MainFragmentActivity.initCallVoiceShowProgress();//add by waderson 20190801 SIP通话音量不能保存?要动态设置??曹强的东西真搞不懂他
+
+        callATimeoutThread = new CallATimeoutThread();
+        callATimeoutThread.start();
     }
 
 
+
+
     private void initRecyclerManager() {
         //Room
         swipeRefreshLayout.setOnRefreshListener(this);
@@ -575,12 +592,12 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
             public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { //上滑删除item
                 upScrllPosition = viewHolder.getAdapterPosition();
                 UdpEntity upScrllUdpEntity = MyApplication.callEntityList.get(upScrllPosition);
-                if (Constants.MANAGER_CALL.equals(upScrllUdpEntity.getType())) {
+                if (Constants.DOCTOR_CALL.equals(upScrllUdpEntity.getType())) {
                     deleteManagerCallingItem(upScrllUdpEntity);
                 } else {
                     deleteCallingItem(upScrllUdpEntity, 0);
                 }
-
+                Constants.DoctorMachineCallStatus = Constants.STANDBY;
             }
         };
         //用Callback构造ItemtouchHelper
@@ -999,6 +1016,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                     loopVoice.setPalyDismiss(true);
                 }
                 endCall();
+                Constants.DoctorMachineCallStatus = Constants.STANDBY;
             }
         } else {
             ToastUtil.showToast("请勿频繁点击!");
@@ -1031,6 +1049,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                         callBed = true;
                         ivCallPic.setImageResource(R.mipmap.ic_calling_sickbed_right_hang_up);
                         mainFragmentActivity.initiateCall(sipAddress, "", sickBedInfo.getDeviceMAC() == null ? "-1" : sickBedInfo.getDeviceMAC());
+                        Constants.CallType = Constants.MAIN_CALL;//设置呼叫类型标记
                     }
                 }
             } else {
@@ -1120,7 +1139,13 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
         if (null == sickbedInformationList || null == sickbedInformationList.get(position) || null == sickbedInformationList.get(position).getPatientID()) {
             return;
         }
-        if (!Constants.CALL_STATE.equals(Constants.STANDBY) && !sickBedInfo.equals(sickbedInformationList.get(position))) {
+        Log.e(TAG,"sickBedInfo "+sickBedInfo);
+        if(sickBedInfo != null){
+            if (!Constants.CALL_STATE.equals(Constants.STANDBY) && !sickBedInfo.equals(sickbedInformationList.get(position))) {
+                ToastUtil.showToast("请先取消当前呼叫");
+                return;
+            }
+        }else if(!Constants.CALL_STATE.equals(Constants.STANDBY)){
             ToastUtil.showToast("请先取消当前呼叫");
             return;
         }
@@ -1133,6 +1158,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                         callBed = true;
                         ivCallPic.setImageResource(R.mipmap.ic_calling_sickbed_right_hang_up);
                         mainFragmentActivity.initiateCall(sipAddress, "", sickBedInfo.getDeviceMAC() == null ? "-1" : sickBedInfo.getDeviceMAC());
+                        Constants.CallType = Constants.MAIN_CALL;//设置呼叫类型标记
                     }
                 } else {
                     endCall();
@@ -1226,6 +1252,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                     }
                 } else {
                     endCall();
+                    Constants.DoctorMachineCallStatus = Constants.STANDBY;
                 }
             }
         } else {
@@ -1315,6 +1342,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                         upScrllPosition = -1;
                         have_Call = false;
                         callBed = false;
+
+
                     }
 
                 } else {
@@ -1324,12 +1353,14 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                 if (Constants.CALL_STATE.equals(Constants.IN_CALL)) {
                     tvBedCallState.setText("  正在呼叫中...");
                     tvCallListState.setText("  正在呼叫中...");
+                    tvCallListRoomMsg.setText("  正在呼叫中...");
                 } else if (Constants.CALL_STATE.equals(Constants.IN_CALLING)) {
                     have_Call = true;
                     setVolumePA(true);
                     upScrllPosition = -1;//通话的时候废掉上滑索引;以免与通话结束后自动删除CALL条目相冲突
                     tvBedCallState.setText("  正在通话中...");
                     tvCallListState.setText("  正在通话中...");
+                    tvCallListRoomMsg.setText("   正在通话中...");
 
                     if (null != MyApplication.serialPortUtil) { //正在呼叫;将关闭外部音响
                         MyApplication.serialPortUtil.stereoControl("0");
@@ -1390,9 +1421,12 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                             }
                             callListAdapter.notifyDataSetChanged();
                             roomAdapter.notifyDataSetChanged();
+
+                            addCallList(udpEntity);//添加到转接给医生机集合
                         }
                         break;
-                    case "call_12": //总控制室呼叫护士主机
+                    case "call_13": //医生主机呼叫护士主机
+                        Log.e("qqqq","nurseHostID "+nurseHostID);
                         if (isMySelfMachine(nurseHostID)) {
                             if (!PalyPhonetics.speakEntityList.contains(udpEntity) && Constants.CALL_STATE.equals(Constants.STANDBY)) {
                                 addPhonetics(udpEntity);
@@ -1406,9 +1440,15 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                             callListAdapter.notifyDataSetChanged();
                             roomAdapter.notifyDataSetChanged();
                         }
+                        Constants.DoctorMachineCallStatus = Constants.IN_CALL;
+
                         break;
-                    case "call_12_hang_up": //总控制室主机取消呼叫 add by waderson 20191108
+                    case "call_13_hang_up": //医生主机取消呼叫 add by waderson 20191108
                         deleteManagerCallingItem(udpEntity);
+                        Constants.DoctorMachineCallStatus = Constants.STANDBY;
+                        break;
+                    case "call_14_doctor_hang_up_phone"://医生主机挂断电话,这时可以进行下一个床头分机的呼叫转移
+                        transmitThreadBool = true;
                         break;
                     case "call_1_b1": //护士已经退出护理
                         if (notEmpty(nurseHostID) && nurseHostID.equals(Constants.MYSELF_ID)) {
@@ -1529,6 +1569,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
             String his = nDis.split(",")[1];
             return Constants.MYSELF_ID.equals(my) && Constants.TRUST_OLD_MAIN_ID.equals(his);
         } else {
+            Log.e("isMySelfMachine","nurseHostID "+nurseHostID+" "+Constants.MYSELF_ID);
             return notEmpty(nurseHostID) && nurseHostID.equals(Constants.MYSELF_ID);
         }
     }
@@ -1971,8 +2012,8 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                         resIdlist.add(R.raw.jinjihujiao);
                     }
                     break;
-                case Constants.MANAGER_CALL://总控
-                    resIdlist.add(R.raw.manager);
+                case Constants.DOCTOR_CALL://医生主
+                    resIdlist.add(R.raw.doctor_host);
                     resIdlist.add(R.raw.hujiao);
                     break;
             }
@@ -2178,7 +2219,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                 ivCallListPic.setVisibility(View.VISIBLE);
                 vRightPatientInfo.setVisibility(View.GONE);
                 vRightCallInfo.setVisibility(View.GONE);
-                tvCallListRoomMsg.setText("总控制室呼叫...");
+                tvCallListRoomMsg.setText("医生主机呼叫...");
             }
             return;
         }
@@ -2352,6 +2393,7 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
                 isMainMIC = false;
             }
         }
+
     }
 
     /**
@@ -2377,7 +2419,9 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
     }
 
     private void sendRemoveManagerCall(UdpEntity udpEntity) {
+        Log.e(TAG,"sendRemoveManagerCall...");
         if (null != udpEntity) {
+            Log.e(TAG,"sendRemoveManagerCall...222");
             String hostId = ((MainFragmentActivity) getActivity()).getInitDataEntity().getDeviceHostingID();
             UdpSendUtil.sendNotificationRemoveManagerCall(udpEntity, hostId);
         }
@@ -2447,6 +2491,10 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
     public void onDestroy() {
         super.onDestroy();
         ButterKnife.unbind(this);
+        if(callATimeoutThread != null){
+            callATimeoutThread.stopThread();
+            callATimeoutThread = null;
+        }
     }
 
     @OnClick(R.id.textView2)
@@ -2459,4 +2507,71 @@ public class CallingBedFragment extends BaseFragment implements SicknessBedAdapt
         UdpSendUtil.sendNurseStationState(((MainFragmentActivity) getActivity()).getInitDataEntity(), 1);
     }
 
+    private void addCallList(UdpEntity udpEntity) {
+        if(callListEntityList==null){
+            callListEntityList = new ArrayList<>();
+        }
+        Log.e(TAG,"addCallList 添加集合。。"+callListEntityList.size());
+         //同步全局呼叫列表中的数据,删除掉多余的
+        for(int i=0;i<callListEntityList.size();i++){
+            CallListEntity callListEntity = callListEntityList.get(i);
+            if(!MyApplication.callEntityList.contains(callListEntity.getUdpEntity())){
+                callListEntityList.remove(callListEntity);
+            }
+        }
+
+        CallListEntity callListEntity = new CallListEntity();
+            callListEntity.setTime(System.currentTimeMillis());
+            callListEntity.setUdpEntity(udpEntity);
+            callListEntityList.add(callListEntity);
+        Log.e(TAG,"addCallList 添加集合222。。"+callListEntityList.size());
+    }
+
+    //判断呼叫列表数据是否超时
+    class CallATimeoutThread extends Thread{
+       @Override
+       public void run() {
+           super.run();
+           while (threadBool){
+               Log.e(TAG,"呼叫超时线程00。。。");
+               if(callListEntityList != null&& callListEntityList.size()!=0){
+                   Log.e(TAG,"呼叫超时线程。。。"+callListEntityList.size()+" "+MyApplication.callEntityList.size());
+               if(transmitThreadBool){
+//               for(int i=0;i< callListEntityList.size();i++){
+                Log.e(TAG,"呼叫超时线程。。。for");
+                final CallListEntity callListEntity = callListEntityList.get(0);
+                if((System.currentTimeMillis()-callListEntity.getTime())>10000){
+                    UdpSendUtil.sendMultitapCall1(callListEntity);
+                    Log.e(TAG,"呼叫超时线程。。。sendCall1");
+                    //转接给医生主机后取消护士主机的呼叫列表 线程里面不能更新UI
+                    mainFragmentActivity.runOnUiThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            deleteCallingItem(callListEntity.getUdpEntity() , 0);
+                        }
+                    });
+
+                    Log.e(TAG,"呼叫超时线程。。。222"+callListEntityList.size()+" "+MyApplication.callEntityList.size());
+                    //转接给医生机之后 就删除拨打过的callListEntity
+                    callListEntityList.remove(callListEntity);
+                    Log.e(TAG,"呼叫超时线程。。。3333"+callListEntityList.size()+" "+MyApplication.callEntityList.size());
+                    transmitThreadBool = false;
+                }
+//            }
+               }
+               }
+               try {
+                   Thread.sleep(5000);
+               } catch (InterruptedException e) {
+                   e.printStackTrace();
+               }
+           }
+       }
+        public void stopThread() {
+            threadBool = false;
+            interrupt();
+        }
+
+   }
+
 }

+ 237 - 18
app/src/main/java/com/wdkl/callingmainnurse/ui/fragment/CallingHostFragment.java

@@ -1,9 +1,13 @@
 package com.wdkl.callingmainnurse.ui.fragment;
 
 import android.os.Bundle;
+import android.os.Handler;
 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.RecyclerView;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
@@ -14,19 +18,25 @@ import android.widget.TextView;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
+import com.wdkl.callingmainnurse.MyApplication;
 import com.wdkl.callingmainnurse.R;
 import com.wdkl.callingmainnurse.adapter.DoctorHostAdapter;
 import com.wdkl.callingmainnurse.adapter.MedicalHostsCallingQueuingInfoAdapter;
 import com.wdkl.callingmainnurse.adapter.NurseHostAdapter;
 import com.wdkl.callingmainnurse.base.BaseFragment;
 import com.wdkl.callingmainnurse.common.Constants;
+import com.wdkl.callingmainnurse.entity.AllDoctorHostEntity;
 import com.wdkl.callingmainnurse.entity.CallingQueuingInfoEntity;
 import com.wdkl.callingmainnurse.entity.DoctorHostEntity;
 import com.wdkl.callingmainnurse.entity.MessageEvent;
 import com.wdkl.callingmainnurse.entity.NurseHostListInfo;
+import com.wdkl.callingmainnurse.entity.UdpEntity;
+import com.wdkl.callingmainnurse.ui.activity.MainFragmentActivity;
 import com.wdkl.callingmainnurse.util.LogUtil;
 import com.wdkl.callingmainnurse.util.StringUtils;
+import com.wdkl.callingmainnurse.util.ToastUtil;
 import com.wdkl.callingmainnurse.util.UIUtils;
+import com.wdkl.callingmainnurse.util.UdpSendUtil;
 import com.zhy.http.okhttp.OkHttpUtils;
 import com.zhy.http.okhttp.callback.StringCallback;
 
@@ -36,6 +46,7 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import butterknife.Bind;
 import butterknife.ButterKnife;
@@ -51,8 +62,9 @@ import static com.wdkl.callingmainnurse.util.ToastUtil.showToast;
 
 public class CallingHostFragment extends BaseFragment implements DoctorHostAdapter.DoctorHostItemOnclickListener,
         NurseHostAdapter.NurseHostItemOnclickListener, View.OnClickListener,
-        MedicalHostsCallingQueuingInfoAdapter.CallingQueuingBarItemOnClickListener, RecyclerView.OnItemTouchListener {
+        MedicalHostsCallingQueuingInfoAdapter.CallingQueuingBarItemOnClickListener, RecyclerView.OnItemTouchListener, SwipeRefreshLayout.OnRefreshListener {
 
+    private String TAG = CallingHostFragment.class.getSimpleName();
     private View mView;
 
     /**
@@ -127,6 +139,17 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
     @Bind(R.id.fragment_tv_doctor_nurse_no)
     TextView nurse_CallStaus;
 
+    //护士主机刷新控件
+    @Bind(R.id.fragment_calling_nurse_layout_sr_refresh)
+    SwipeRefreshLayout swipeNurseRefreshLayout;
+    //  醫生主机刷新控件
+    @Bind(R.id.fragment_calling_doctor_layout_sr_refresh)
+    SwipeRefreshLayout swipeDoctorRefreshLayout;
+    //所有护士主机列表
+    private AllDoctorHostEntity AllDoctorHostEntity;
+    private boolean isCallListCall = true;//呼叫列表是否在通话中,默认是在通话中
+
+
     @Nullable
     @Override
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -152,6 +175,8 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
         ivEndCalling.setOnClickListener(this);
         rvDoctor.addOnItemTouchListener(this);
         rvNurse.addOnItemTouchListener(this);
+        swipeNurseRefreshLayout.setOnRefreshListener(this);
+        swipeDoctorRefreshLayout.setOnRefreshListener(this);
     }
 
     @Override
@@ -163,6 +188,7 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
     protected void initData() {
         initRecyclerManager();
         initCallQueuingInfoBarData();
+
     }
 
     @Override
@@ -177,8 +203,9 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
         nurseHostList = new ArrayList<>();
         doctorHostList = new ArrayList<>();
 
-        LinearLayoutManager manager = new LinearLayoutManager(getActivity());
-        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
+//        LinearLayoutManager manager = new LinearLayoutManager(getActivity());
+//        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        GridLayoutManager manager = new GridLayoutManager(getActivity(), 4);
         rvDoctor.setLayoutManager(manager);
         doctorHostAdapter = new DoctorHostAdapter(getActivity(), doctorHostList);
         rvDoctor.setAdapter(doctorHostAdapter);
@@ -191,8 +218,12 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
         rvNurse.setAdapter(nurseHostAdapter);
         nurseHostAdapter.setNurseHostItemOnclickListener(this);
 
-        getNurseHostList();
+//        getNurseHostList();
         getDoctorHostList();
+
+//        if(Constants.CALL_STATE.equals(Constants.IN_CALL) ){
+//            nurse_CallStaus.setText("  对方正在呼叫中,请先取消对方的呼叫...");
+//        }
     }
 
     /**
@@ -220,27 +251,39 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
      */
     private void getDoctorHostList() {
         if (!StringUtils.notEmpty(Constants.PartID)) return;
+//        OkHttpUtils.post().url(Constants.URL + Constants.URL_END + Constants.CALLINGMAINNURSE_DOCTORLIST)
         OkHttpUtils.post().url(Constants.URL + Constants.URL_END + Constants.CALLINGMAINNURSE_DOCTORLIST)
-                .addParams("PartID", Constants.PartID)
+        .addParams("PartID", Constants.PartID)
                 .addParams("deviceId", Constants.MYSELF_ID)
                 .build()
                 .execute(new StringCallback() {
                     @Override
                     public void onError(Call call, Exception e, int id) {
+                        if (swipeNurseRefreshLayout.isRefreshing()) {
+                            swipeNurseRefreshLayout.setRefreshing(false);
+                        }
                         hideProgress();
                     }
 
                     @Override
                     public void onResponse(String response, int id) {
+                        if (swipeNurseRefreshLayout.isRefreshing()) {
+                            swipeNurseRefreshLayout.setRefreshing(false);
+                        }
                         if (notEmpty(response)) {
-                            LogUtil.d(CallingHostFragment.class, "DoctorHostListresponse==" + response);
+                            LogUtil.d(CallingHostFragment.class, "part info==" + response);
                             String code = getStringData(response, "Code");
+                            Log.e(TAG,"code "+code);
                             if (code.equals("OK!")) {
-                                doctorHostList = new Gson().fromJson(getStringData(response, "hostList"), new TypeToken<ArrayList<DoctorHostEntity>>() {
+                                String data = response.substring(0, response.length() - 4);
+                                Log.e(TAG,"返回的数据data "+data);
+                                Gson gson = new Gson();
+                                doctorHostList = gson.fromJson(getStringData(response, "hostList"), new TypeToken<ArrayList<DoctorHostEntity>>() {
                                 }.getType());
                                 if (null != doctorHostList) {
                                     doctorHostAdapter.updateList(doctorHostList);
                                 }
+
                             } else {
                                 LogUtil.i(CallingHostFragment.class, "Code==" + code + "---数据返回错误!");
                             }
@@ -325,25 +368,116 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
      */
     @Override
     public void doctorHostItemOnclick(View view, int position) {
-        //tvCallingTips.setText("与医生主机" + (position + 1) + "通话中...");
-        //rlIncall.setVisibility(View.VISIBLE);
-        //rlNotInCallBg.setVisibility(View.GONE);
-        //ivDoctorOrNurseCalling.setImageResource(R.mipmap.ic_doctor_right_in_call);
-        if (null == doctorHostList || doctorHostList.size() <= 0 || null == doctorHostList.get(position))
+        Log.e(TAG," Constants.CALL_STATE "+Constants.CALL_STATE);
+
+        if (!Constants.CALL_STATE.equals(Constants.STANDBY) && Constants.CallType.equals(Constants.MANAGER_CALL)) {
+            ToastUtil.showToast("请先取消当前呼叫");
             return;
-        if (null != doctorHostList.get(position) && doctorHostList.get(position).isChecked()) {
-            doctorHostList.get(position).setChecked(false);
-        } else {
+        } else if(!Constants.DoctorMachineCallStatus.equals(Constants.STANDBY)){
+            ToastUtil.showToast("请先取消当前呼叫");
+            return;
+        }
+        if (doctorHostList.size() <= 0 || position >= doctorHostList.size() || null == doctorHostList.get(position)) {
+            return;
+        }
+        final DoctorHostEntity  info = doctorHostList.get(position);
+        if (!info.isChecked()) {
             for (DoctorHostEntity entity : doctorHostList) {
                 if (null == entity) continue;
                 entity.setChecked(false);
             }
-            doctorHostList.get(position).setChecked(true);
-            showToast("该功能还在开发中...");
+            info.setChecked(true);
+            nurseHostAdapter.notifyDataSetChanged();
+
+//            tvCallingTips.setText(info.getPART_NAME());
+//            nurse_CallStaus.setText(info.getPART_NAME());
+            ivDoctorOrNurseCalling.setImageResource(R.mipmap.ic_nurse_right_in_call);
+            ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
+            ivEndCalling.setVisibility(View.VISIBLE);
+            rlIncall.setVisibility(View.VISIBLE);
+            rlNotInCallBg.setVisibility(View.GONE);
+
+
+
+//            getPartData(info.getID());
+//            getNurseHostInfo(info.getID());
+
+            ivEndCalling.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    if(!Constants.DoctorMachineCallStatus.equals(Constants.STANDBY)){
+                        ToastUtil.showToast("请先取消当前呼叫");
+                        return;
+                    }
+                    getActivity().runOnUiThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            callClick(info.getDeviceHostingID());
+                        }
+                    });
+                }
+            });
+
+        }
+    }
+
+    private void callClick(String hostId) {
+        if (Constants.CALL_STATE.equals(Constants.STANDBY)) {
+            //呼叫中
+            ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_hang_up);
+            nurse_CallStaus.setText("正在呼叫...");
+            Log.e(TAG,"callClick 正在呼叫");
+            UdpSendUtil.sendNurseHostCall(hostId);
+            Constants.CALL_STATE = Constants.IN_CALL;
+            Constants.CALLING_HOST_ID = hostId;
+            Constants.CallType = Constants.MANAGER_CALL;
+        } else {
+            //主动挂断
+            if (Constants.CallType.equals(Constants.MANAGER_CALL)) {
+                ((MainFragmentActivity) getActivity()).endCalled();
+                ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
+                nurse_CallStaus.setText("");
+                UdpSendUtil.sendNurseHostHangUp(hostId);
+                Constants.CALL_STATE = Constants.STANDBY;
+                Constants.CALLING_HOST_ID = "";
+            }
         }
-        doctorHostAdapter.notifyDataSetChanged();
     }
 
+//    private void getPartData(String partId) {
+//        if (!StringUtils.notEmpty(Constants.URL)) return;
+//        if (!StringUtils.notEmpty(partId)) return;
+//        OkHttpUtils.post().url(Constants.URL + Constants.URL_END + Constants.CALLINGMAINNURSE_HOSPITAL)
+//                .addParams("PartID", partId)
+//                .build()
+//                .execute(new StringCallback() {
+//                    @Override
+//                    public void onError(Call call, Exception e, int id) {
+//                        LogUtil.d("getPartData", "===error===");
+//                    }
+//
+//                    @Override
+//                    public void onResponse(String response, int id) {
+//                        String data = response.substring(0, response.length() - 4);
+//                        LogUtil.d("getPartData", "data=="+data);
+//                        try {
+//                            JSONObject jsonObj = new JSONObject(data);
+//                            if (jsonObj.getString("Code").equals("ERROR!")) {
+//                                LogUtil.d("getPartData", "网络错误");
+//                            } else {
+//                                Gson gson = new Gson();
+//                                hospitalInfoEntity = gson.fromJson(data, HospitalInfoEntity.class);
+//                                ArrayList<String> doctorList = (ArrayList<String>) hospitalInfoEntity.getDutyDoctorList();
+//                                ArrayList<String> nurseList = (ArrayList<String>) hospitalInfoEntity.getNurseOnDutyList();
+//                                dutyDoctorAdapter.updateList(doctorList);
+//                                dutyNurseAdapter.updateList(nurseList);
+//                            }
+//                        } catch (JSONException e) {
+//                            e.printStackTrace();
+//                        }
+//                    }
+//                });
+//    }
     /**
      * 护士主机适配器条目的点击事件
      *
@@ -409,6 +543,77 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void onMoonEvent(MessageEvent messageEvent) {
+        Log.e(TAG, "onMoonEvent " + messageEvent.getType());
+        switch (messageEvent.getType()) {
+            case Constants.EVENT_SIP:
+                Log.e(TAG, "Constants.CALL_STATE==" + Constants.CALL_STATE);
+                if (Constants.CALL_STATE.equals(Constants.STANDBY)) {
+                    LogUtil.d("onMoonEvent", "通话状态==STANDBY");
+
+                    if (null != MyApplication.serialPortUtil) { //呼叫结束了;打开外部音响
+                        MyApplication.serialPortUtil.stereoControl("1");
+                    }
+                    ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
+                    nurse_CallStaus.setText("");
+                }
+                if (Constants.CALL_STATE.equals(Constants.IN_CALL)) {
+
+                } else if (Constants.CALL_STATE.equals(Constants.IN_CALLING)) {
+                    if(!Constants.CallType.equals(Constants.MAIN_CALL)){
+                        ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_hang_up);
+                        nurse_CallStaus.setText("  正在通话中...");
+                    }
+
+                    if (null != MyApplication.serialPortUtil) { //正在呼叫;将关闭外部音响
+                        MyApplication.serialPortUtil.stereoControl("0");
+                    }
+
+                    MainFragmentActivity.initCallVoiceShowProgress();//20190801 waderson
+                    new Handler().postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            MainFragmentActivity.initCallVoiceShowProgress();//20190801 waderson
+                        }
+                    }, 100);
+                    new Handler().postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            MainFragmentActivity.initCallVoiceShowProgress();//20190801 waderson
+                        }
+                    }, 600);
+                    new Handler().postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            MainFragmentActivity.initCallVoiceShowProgress();//20190801 waderson
+                        }
+                    }, 1100);
+
+                }
+
+                break;
+            case Constants.EVENT_UDP:
+                Log.e(TAG, "onMoonEvent返回。。。EVENT_UDP");
+                UdpEntity udpEntity = (UdpEntity) messageEvent.getMessage();
+                String nurseHostID = udpEntity.getNurseHostID();
+                String headMachineID = udpEntity.getHeadMachineID();
+                switch (udpEntity.getIndexes()) {
+                    case "call_12_upremove":
+                        ivEndCalling.setBackgroundResource(R.mipmap.ic_calling_sickbed_right_calling);
+                        nurse_CallStaus.setText("");
+                       Constants.DoctorMachineCallStatus = Constants.STANDBY;
+                        break;
+                    case "call_13"://医生机呼叫护士主机
+                        Constants.DoctorMachineCallStatus = Constants.IN_CALL;
+                        Log.e(TAG, "onMoonEvent。。。EVENT_UDP医生机呼叫护士主机");
+                        break;
+                    case "call_13_hang_up": //医生主机取消呼叫 add by waderson 20191108
+                        Constants.DoctorMachineCallStatus = Constants.STANDBY;
+                        break;
+                }
+                break;
+
+        }
+
     }
 
     /**
@@ -430,4 +635,18 @@ public class CallingHostFragment extends BaseFragment implements DoctorHostAdapt
         }
         return data;
     }
+
+    @Override
+    public void onRefresh() {
+        resetRightList();
+        getDoctorHostList();
+    }
+    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);
+    }
 }

+ 39 - 4
app/src/main/java/com/wdkl/callingmainnurse/util/AnalysisUdpUtil.java

@@ -34,7 +34,7 @@ public class AnalysisUdpUtil {
     private AnalysisUdpUtil() {
     }
 
-    public static void AnalysisUdp(String udpMsg, Context context) {//接收UDP
+    public static void AnalysisUdp(String udpMsg, Context context) { //接收UDP
         LogUtil.d("CheckUpdate", "1===udpMsg==" + udpMsg);
         if (!isOpen) {
             return;
@@ -45,9 +45,9 @@ public class AnalysisUdpUtil {
             final String[] data = udpMsg.split(Character.toString((char) 3));
 
             //总控制室主机呼叫
-            if (Constants.MANAGER_CALL.equals(data[8])) {
+            if (Constants.DOCTOR_CALL.equals(data[8])) {
                 switch (data[0]) {
-                    case "call_12"://总控制室主机呼叫护士主机
+                    case "call_13"://总控制室主机呼叫护士主机
                         UdpEntity udpEntity = new UdpEntity();
                         udpEntity.setIndexes(data[0]);
                         udpEntity.setNurseHostID(data[1]);
@@ -63,7 +63,7 @@ public class AnalysisUdpUtil {
                         udpEntity.setShowText("总控制室主机呼叫护士主机");
                         EventBus.getDefault().post(new MessageEvent(udpEntity, Constants.EVENT_UDP));
                         break;
-                    case "call_12_hang_up": //总控制室主机取消呼叫
+                    case "call_13_hang_up": //总控制室主机取消呼叫
                         UdpEntity call_12_hang_up = new UdpEntity();
                         call_12_hang_up.setIndexes(data[0]);
                         call_12_hang_up.setNurseHostID(data[1]);
@@ -79,6 +79,22 @@ public class AnalysisUdpUtil {
                         call_12_hang_up.setShowText("总控制室主机取消呼叫");
                         EventBus.getDefault().post(new MessageEvent(call_12_hang_up, Constants.EVENT_UDP));
                         break;
+                    case "call_12_upremove": //主机上滑移除了呼叫列表中的一个条目
+                        UdpEntity call_12_upremove = new UdpEntity();
+                        call_12_upremove.setIndexes(data[0]);
+                        call_12_upremove.setNurseHostID(data[1]);
+                        call_12_upremove.setDoorwayMachineID(data[2]);
+                        call_12_upremove.setHeadMachineID(data[3]);
+                        call_12_upremove.setSipAddress(data[4]);
+                        call_12_upremove.setRoomNumber(data[5]);
+                        call_12_upremove.setBedNumber(data[6]);
+                        call_12_upremove.setLevel(data[7]);
+                        call_12_upremove.setType(data[8]);
+                        call_12_upremove.setName(data[9]);
+                        call_12_upremove.setDeviceMAC(data[10]);
+                        call_12_upremove.setShowText("主机上滑移除呼叫列表中的一个条目");
+                        EventBus.getDefault().post(new MessageEvent(call_12_upremove, Constants.EVENT_UDP));
+                        break;
                 }
             }
 
@@ -211,6 +227,25 @@ public class AnalysisUdpUtil {
                 case "call_11":
                     //手表呼叫护士主机");
                     break;
+                case "call_14_doctor_hang_up_phone"://医生主机挂断电话
+                    UdpEntity udpEntity_14_doctor_hang_up_phone = new UdpEntity();
+                    udpEntity_14_doctor_hang_up_phone.setIndexes(data[0]);
+                    udpEntity_14_doctor_hang_up_phone.setNurseHostID(data[1]);
+                    udpEntity_14_doctor_hang_up_phone.setDoorwayMachineID(data[2]);
+                    udpEntity_14_doctor_hang_up_phone.setHeadMachineID(data[3]);
+                    udpEntity_14_doctor_hang_up_phone.setSipAddress(data[4]);
+                    udpEntity_14_doctor_hang_up_phone.setRoomNumber(data[5]);
+                    udpEntity_14_doctor_hang_up_phone.setBedNumber(data[6]);
+                    udpEntity_14_doctor_hang_up_phone.setLevel(data[7]);
+                    udpEntity_14_doctor_hang_up_phone.setType(data[8]);
+                    udpEntity_14_doctor_hang_up_phone.setName(data[9]);
+                    udpEntity_14_doctor_hang_up_phone.setDeviceMAC(data[10]);
+                    udpEntity_14_doctor_hang_up_phone.setShowText("医生主机挂断电话");
+                    //推向event
+                    EventBus.getDefault().post(new MessageEvent(udpEntity_14_doctor_hang_up_phone, Constants.EVENT_UDP));
+                    break;
+
+
                 case "end_1":
                     //挂断");
                     break;

+ 61 - 0
app/src/main/java/com/wdkl/callingmainnurse/util/UdpSendUtil.java

@@ -1,8 +1,10 @@
 package com.wdkl.callingmainnurse.util;
 
 import android.content.Context;
+import android.text.TextUtils;
 
 import com.wdkl.callingmainnurse.common.Constants;
+import com.wdkl.callingmainnurse.entity.CallListEntity;
 import com.wdkl.callingmainnurse.entity.InitDataEntity;
 import com.wdkl.callingmainnurse.entity.MessageEntity;
 import com.wdkl.callingmainnurse.entity.UdpEntity;
@@ -243,6 +245,43 @@ public class UdpSendUtil {
     }
 
     /**
+     * 护士主机向医生主机请求通话
+     */
+    public static void sendNurseHostCall(String hostId) {
+        if (TextUtils.isEmpty(hostId)) {
+            return;
+        }
+        AnalysisUdpUtil.sendUdpData("call_12",
+                hostId, //接收通话请求的护士主机id
+                "",
+                "",
+                Constants.SIP_ID, //总控主机sip id
+                "",
+                "",
+                "",
+                Constants.MANAGER_CALL, //呼叫类型
+                "",
+                Constants.MAC_ADDRESS);
+    }
+
+    /**
+     * 护士主机挂断通话,需要通知对方医生主机
+     */
+    public static void sendNurseHostHangUp(String hostId) {
+        AnalysisUdpUtil.sendUdpData("call_12_hang_up",
+                hostId, //通话对方的护士主机id
+                "",
+                "",
+                Constants.SIP_ID,
+                "",
+                "",
+                "",
+                Constants.MANAGER_CALL, //呼叫类型
+                "",
+                Constants.MAC_ADDRESS);
+    }
+
+    /**
      * 安卓端接通电话;通知外面点阵屏;安卓端本身暂时没有用到这条UDP
      * 我将连发2次,防止UDP丢失
      *
@@ -334,4 +373,26 @@ public class UdpSendUtil {
                 messageEntity.getFileOriginalName(), messageEntity.getFileStoreName(),
                 messageEntity.getMessageTime(), messageEntity.getContent(), "0");
     }
+
+    /**
+     * 护士主机转接床头分机呼叫医生主机
+     *
+     * @param callListEntity
+     */
+    public static void sendMultitapCall1(CallListEntity callListEntity) {
+        if (null == callListEntity) return;
+        AnalysisUdpUtil.sendUdpData("call_14"
+                , callListEntity.getUdpEntity().getNurseHostID()
+                , callListEntity.getUdpEntity().getDoorwayMachineID()
+                , callListEntity.getUdpEntity().getHeadMachineID()
+                , callListEntity.getUdpEntity().getSipAddress()
+                , callListEntity.getUdpEntity().getRoomNumber()
+                , callListEntity.getUdpEntity().getBedNumber()
+                , callListEntity.getUdpEntity().getLevel()
+                , Constants.MUlTITAP_CALL
+                , callListEntity.getUdpEntity().getName()
+                , "0");
+    }
+
+
 }

+ 0 - 1
app/src/main/res/layout/activity_main_sideslip_popu_window.xml

@@ -51,7 +51,6 @@
             android:layout_gravity="center"
             android:layout_weight="1"
             android:gravity="center"
-            android:visibility="gone"
             android:orientation="vertical">
 
             <ImageView

+ 16 - 4
app/src/main/res/layout/fragment_calling_doctor_medica_hosts.xml

@@ -17,13 +17,19 @@
             android:layout_height="wrap_content"
             android:layout_marginRight="@dimen/margin_10dp"
             android:layout_weight="2"
-            android:orientation="vertical">
-
+            android:orientation="vertical"
+            android:visibility="gone">
+            <android.support.v4.widget.SwipeRefreshLayout
+                android:id="@+id/fragment_calling_nurse_layout_sr_refresh"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="@dimen/margin_10dp">
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/fragment_rv_nurse"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:overScrollMode="never"></android.support.v7.widget.RecyclerView>
+            </android.support.v4.widget.SwipeRefreshLayout>
         </LinearLayout>
 
         <LinearLayout
@@ -32,14 +38,20 @@
             android:layout_height="wrap_content"
             android:layout_marginRight="@dimen/margin_10dp"
             android:layout_weight="2"
-            android:orientation="vertical">
-
+            android:orientation="vertical"
+            >
+            <android.support.v4.widget.SwipeRefreshLayout
+                android:id="@+id/fragment_calling_doctor_layout_sr_refresh"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="@dimen/margin_10dp">
             <android.support.v7.widget.RecyclerView
                 android:id="@+id/fragment_rv_doctor"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:overScrollMode="never">
             </android.support.v7.widget.RecyclerView>
+            </android.support.v4.widget.SwipeRefreshLayout>
         </LinearLayout>
 
     </LinearLayout>

+ 70 - 31
app/src/main/res/layout/fragment_medical_hosts_call_queuing_info_bar_layout.xml

@@ -8,7 +8,7 @@
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="match_parent"
         android:orientation="vertical">
 
         <TextView
@@ -19,48 +19,89 @@
             android:paddingLeft="@dimen/margin_5dp"
             android:text="呼叫排队信息栏"
             android:textColor="@color/white"
-            android:textSize="20px" />
+            android:textSize="20px"
+            android:visibility="gone"/>
 
         <android.support.v7.widget.RecyclerView
             android:id="@+id/fragment_rv_calling_queuing_info_bar"
             android:layout_width="match_parent"
             android:layout_height="240dp"
-            android:overScrollMode="never">
-
-        </android.support.v7.widget.RecyclerView>
-
-        <TextView
-            android:id="@+id/fragment_tv_calling_tips"
-            android:layout_width="match_parent"
-            android:layout_height="40dp"
-            android:layout_gravity="center"
-            android:layout_marginLeft="0.5dp"
-            android:layout_marginRight="0.5dp"
-            android:background="#1d5e8b"
-            android:gravity="center_vertical"
-            android:paddingLeft="@dimen/margin_5dp"
-            android:textColor="@color/yellow_color"
-            android:textSize="20px" />
+            android:overScrollMode="never"
+            android:background="@drawable/shape_medical_host_not_in_call_bg"
+            android:visibility="gone"/>
 
         <RelativeLayout
             android:id="@+id/fragment_rl_not_in_call_bg"
             android:layout_width="match_parent"
-            android:layout_height="400dp"
-            android:background="@drawable/shape_medical_host_not_in_call_bg"></RelativeLayout>
+            android:layout_height="match_parent"
+            android:background="@drawable/shape_medical_host_not_in_call_bg"
+            android:visibility="gone">
+        </RelativeLayout>
 
         <RelativeLayout
             android:id="@+id/fragment_medical_host_rl_in_call"
             android:layout_width="match_parent"
-            android:layout_height="400dp"
-            android:background="@drawable/shape_medical_host_in_call_bg"
-            android:visibility="gone">
+            android:layout_height="match_parent"
+            android:background="#2e95cf">
+
+            <TextView
+                android:id="@+id/tv_doctor_on_duty"
+                android:layout_width="match_parent"
+                android:layout_height="40dp"
+                android:background="#287fa8"
+                android:gravity="center"
+                android:paddingLeft="@dimen/margin_5dp"
+                android:text="值班医生"
+                android:textColor="@color/white"
+                android:textSize="20sp" />
+
+            <android.support.v7.widget.RecyclerView
+                android:id="@+id/fragment_rv_doctors"
+                android:layout_width="match_parent"
+                android:layout_height="100dp"
+                android:layout_marginTop="10dp"
+                android:layout_below="@id/tv_doctor_on_duty"
+                android:overScrollMode="never"
+                android:background="#2e95cf" />
+
+            <TextView
+                android:id="@+id/tv_nurse_on_duty"
+                android:layout_width="match_parent"
+                android:layout_height="40dp"
+                android:layout_below="@id/fragment_rv_doctors"
+                android:background="#287fa8"
+                android:gravity="center"
+                android:paddingLeft="@dimen/margin_5dp"
+                android:text="值班护士"
+                android:textColor="@color/white"
+                android:textSize="20sp" />
+
+            <android.support.v7.widget.RecyclerView
+                android:id="@+id/fragment_rv_nurses"
+                android:layout_width="match_parent"
+                android:layout_height="100dp"
+                android:layout_marginTop="10dp"
+                android:layout_below="@id/tv_nurse_on_duty"
+                android:overScrollMode="never"
+                android:background="#2e95cf" />
+
+            <TextView
+                android:id="@+id/fragment_tv_calling_tips"
+                android:layout_width="match_parent"
+                android:layout_height="40dp"
+                android:layout_below="@id/fragment_rv_nurses"
+                android:background="#1d5e8b"
+                android:gravity="center"
+                android:textColor="@color/yellow_color"
+                android:textSize="16sp" />
 
             <ImageView
                 android:id="@+id/fragment_iv_doctor_or_nurse_calling"
                 android:layout_width="100dp"
                 android:layout_height="100dp"
+                android:layout_below="@id/fragment_tv_calling_tips"
                 android:layout_centerHorizontal="true"
-                android:layout_marginTop="@dimen/margin_30dp"
+                android:layout_marginTop="80dp"
                 android:background="@mipmap/ic_trusteeship_n" />
 
             <TextView
@@ -70,19 +111,17 @@
                 android:layout_below="@+id/fragment_iv_doctor_or_nurse_calling"
                 android:layout_centerInParent="true"
                 android:layout_marginTop="@dimen/margin_10dp"
-                android:text="医生主机二"
                 android:textColor="@color/white"
-                android:textSize="20px" />
+                android:textSize="16sp" />
 
             <ImageView
                 android:id="@+id/fragment_iv_end_calling"
-                android:layout_width="100dp"
-                android:layout_height="40dp"
+                android:layout_width="200dp"
+                android:layout_height="60dp"
                 android:layout_below="@+id/fragment_tv_doctor_nurse_no"
-                android:layout_centerInParent="true"
-                android:layout_marginTop="130dp"
+                android:layout_centerHorizontal="true"
+                android:layout_marginTop="80dp"
                 android:background="@mipmap/ic_calling_sickbed_right_calling" />
-
         </RelativeLayout>
     </LinearLayout>
 </LinearLayout>

BIN
app/src/main/res/raw/doctor_host.mp3