浏览代码

调整门口机界面显示,增加床位分机呼叫显示,优化护理按钮控制等

weizhengliang 2 年之前
父节点
当前提交
d5c48ba549

+ 191 - 66
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivity.kt

@@ -18,6 +18,7 @@ import com.google.gson.Gson
 import com.wdkl.app.ncs.callingdoor.BuildConfig
 import com.wdkl.app.ncs.callingdoor.R
 import com.wdkl.app.ncs.callingdoor.agreement.CallingdoorAgreement
+import com.wdkl.app.ncs.callingdoor.bean.CallingItem
 import com.wdkl.app.ncs.callingdoor.databinding.CallingdoorMainLayBinding
 import com.wdkl.app.ncs.callingdoor.fragment.*
 import com.wdkl.app.ncs.callingdoor.helper.*
@@ -51,17 +52,7 @@ import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
 import com.wdkl.ncs.android.middleware.udp.ServerInfoUtil
 import com.wdkl.ncs.android.middleware.utils.AppUtil
 import com.wdkl.ncs.android.middleware.utils.CommonUtils
-import com.wdkl.ncs.android.middleware.utils.Util
 import kotlinx.android.synthetic.main.callingdoor_main_lay.*
-import kotlinx.android.synthetic.main.callingdoor_main_lay.app_version
-import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_call
-import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_call_bed
-import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_nurse
-import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_support
-import kotlinx.android.synthetic.main.callingdoor_main_lay.room_cancel_call
-import kotlinx.android.synthetic.main.callingdoor_main_lay.tv_room_name
-import kotlinx.android.synthetic.main.callingdoor_main_lay.view_flipper
-import kotlinx.android.synthetic.main.callingdoor_main_lay_rk3288.*
 import kotlinx.android.synthetic.main.view_bed_name.*
 import kotlinx.android.synthetic.main.view_title_layout.*
 import okhttp3.OkHttpClient
@@ -75,6 +66,7 @@ import org.linphone.core.TransportType
 import serialporttest.utils.SerialPortUtil
 import java.io.*
 import java.util.*
+import java.util.concurrent.Executors
 import java.util.concurrent.TimeUnit
 
 
@@ -105,7 +97,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
     private var initialized :Boolean = false
     private var loaded: Boolean = false
 
-    private var nursingInteId: Int? = null
+    private var nursingInteId: Int = -1
 
     private var clickTime : Long = 0
     private var clickSosTime : Long = 0
@@ -118,7 +110,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
     private var cancelRestart = false
     private var copyDone = false
 
-    private var bedCalls = ArrayList<String>()
+    private var bedCalls = ArrayList<CallingItem>()
 
     private val handler by lazy { Handler(Looper.getMainLooper()) }
 
@@ -182,6 +174,12 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
                     //默认门灯白色
                     Thread.sleep(200)
                     SerialPortHelper.setDoorLight(1, "111")
+
+                    Constant.inNursing = SettingConfig.getInNursing(activity)
+                    if (Constant.inNursing) {
+                        nursingInteId = SettingConfig.getNursingId(activity)
+                        enterNursing()
+                    }
                 } catch (e: Exception) {
                     e.printStackTrace()
                 }
@@ -239,6 +237,19 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
         }*/
 
         Log.d(TAG, "app data file: " + filesDir.absoluteFile + ", canWrite: " + filesDir.absoluteFile.canWrite())
+
+        startScheduledExecutor()
+    }
+
+    private fun startScheduledExecutor() {
+        val timerTask: TimerTask = object : TimerTask() {
+            override fun run() {
+                checkCalls()
+            }
+        }
+
+        val executor = Executors.newSingleThreadScheduledExecutor()
+        executor!!.scheduleAtFixedRate(timerTask, 100, 30, TimeUnit.SECONDS)
     }
 
     private fun checkAppExist() : Boolean {
@@ -455,6 +466,28 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
         }
     }
 
+    private fun enterNursing() {
+        SerialPortHelper.setDoorLight(1, Constant.nursingColor) //绿色
+
+        //room_action_nurse.text = "退出护理"
+        room_action_nurse.setBackgroundResource(R.mipmap.ic_bottom_btn_bg)
+        if (TextUtils.isEmpty(Constant.NursingTitle)) {
+            tv_room_name.text = Constant.ROOM_NAME + "护理中..."
+        } else {
+            tv_room_name.text = Constant.ROOM_NAME + " " + Constant.NursingTitle + "..."
+        }
+        tv_room_name.setTextColor(resources.getColor(R.color.nursing_color))
+    }
+
+    private fun exitNursing() {
+        DoorLightHelper.resetDoorLight()
+
+        //room_action_nurse.text = "进入护理"
+        room_action_nurse.setBackgroundResource(R.mipmap.bg_bottom_btn)
+        tv_room_name.text = Constant.ROOM_NAME
+        tv_room_name.setTextColor(resources.getColor(R.color.main_color))
+    }
+
     override fun bindEvent() {
         //护理按钮
         room_action_nurse.setOnLongClickListener {
@@ -470,32 +503,21 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
 
             if (Constant.inNursing) {
                 Constant.inNursing = false
-                if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL) || "WDMK_I".equals(Build.MODEL) || "WDMKI".equals(Build.MODEL)) {
-                    SerialPortHelper.setDoorLight(1, "111") //白色
-                }
-                //room_action_nurse.text = "进入护理"
-                room_action_nurse.setBackgroundResource(R.mipmap.bg_bottom_btn)
-                tv_room_name.text = Constant.ROOM_NAME
-                tv_room_name.setTextColor(resources.getColor(R.color.main_color))
-                /*if (Constant.DEVICE_ID != -1 && nursingInteId != null) {
+                SettingConfig.setInNursing(activity, false)
+                exitNursing()
+
+                if (Constant.DEVICE_ID != -1 && nursingInteId != -1) {
                     OtherUtil.sendNursingEnd(Constant.DEVICE_ID, nursingInteId)
-                }*/
+                    nursingInteId = -1
+                }
             } else {
                 Constant.inNursing = true
-                if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL) || "WDMK_I".equals(Build.MODEL) || "WDMKI".equals(Build.MODEL)) {
-                    SerialPortHelper.setDoorLight(1, Constant.nursingColor) //绿色
-                }
-                //room_action_nurse.text = "退出护理"
-                room_action_nurse.setBackgroundResource(R.mipmap.ic_bottom_btn_bg)
-                if (TextUtils.isEmpty(Constant.NursingTitle)) {
-                    tv_room_name.text = Constant.ROOM_NAME + " 正在护理中..."
-                } else {
-                    tv_room_name.text = Constant.ROOM_NAME + " " + Constant.NursingTitle + "..."
-                }
-                tv_room_name.setTextColor(resources.getColor(R.color.nursing_color))
-                /*if (Constant.DEVICE_ID != -1) {
+                SettingConfig.setInNursing(activity, true)
+                enterNursing()
+
+                if (Constant.DEVICE_ID != -1) {
                     OtherUtil.sendNursing(Constant.DEVICE_ID)
-                }*/
+                }
             }
 
             return@setOnLongClickListener true
@@ -587,6 +609,10 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
                 showMessage("网络异常!")
             }
 
+            Constant.callNums = 0
+            DoorLightHelper.resetDoorLight()
+            EventBus.getDefault().post(MessageEvent("clear_calls", Constant.EVENT_CLEAR_CALLS))
+
             SpeechUtil.getInstance().stopSpeak()
             bedCalls.clear()
             view_flipper.removeAllViews()
@@ -771,6 +797,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
         startTcp()
         showMessage("tcp开始连接...host: " + Constant.TCP_SERVER_URL + ", port: " + Constant.TCP_PORT)
 
+        SettingConfig.setNetErrResetCount(this, 0)
+
         Thread(Runnable {
             while (!initialized) {
                 runOnUiThread(Runnable {
@@ -905,6 +933,12 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
             if (partSetting.nursingColorRgb != null && partSetting.nursingColorRgb.length == 3 && TextUtils.isDigitsOnly(partSetting.nursingColorRgb)) {
                 Constant.nursingColor = partSetting.nursingColorRgb
             }
+
+            Constant.inNursing = SettingConfig.getInNursing(activity)
+            if (Constant.inNursing) {
+                nursingInteId = SettingConfig.getNursingId(activity)
+                enterNursing()
+            }
         } catch (ex: Exception) {
             ex.printStackTrace()
         }
@@ -979,13 +1013,25 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
                 }
             }
         }*/
+
+        if (buffer[7].toInt() == 1 || buffer[7].toInt() == 2) {
+            //卫生间紧急按钮: 一定时间内重复多次按无效
+            if (System.currentTimeMillis() - clickSosTime > 10000 || !Constant.sosOn) {
+                runOnUiThread {
+                    clickSosTime = System.currentTimeMillis()
+                    if (Constant.TCP_CONNECTED) {
+                        SOSHelper.sosStart()
+                    }
+                }
+            }
+        }
     }
 
     override fun serialPortSOSCall(status: String?) {
         Log.d("serialPortSOSCall", "紧急按钮: " + status)
         if ("0".equals(status)) {
             //卫生间紧急按钮: 一定时间内重复多次按无效
-            if (System.currentTimeMillis() - clickSosTime > 10000) {
+            if (System.currentTimeMillis() - clickSosTime > 10000 || !Constant.sosOn) {
                 runOnUiThread {
                     clickSosTime = System.currentTimeMillis()
                     if (Constant.TCP_CONNECTED) {
@@ -1129,12 +1175,14 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
                         if (tcpModel.action == TcpAction.SideAction.NURSING) {
                             val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                             nursingInteId = interactionVO.id
+                            SettingConfig.setNursingId(activity, nursingInteId)
+                        } else if (tcpModel.action == TcpAction.SideAction.SHOW || tcpModel.action == TcpAction.SideAction.CLEAR) {
+                            updateCallInfo(tcpModel)
                         } else {
                             /*if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL) || "WDMK_I".equals(Build.MODEL) || "WDMKI".equals(Build.MODEL)) {
                                 DoorLightHelper.handleDoorLight(tcpModel)
                             }*/
 
-                            DoorLightHelper.handleDoorLight(tcpModel)
                             callControl(tcpModel)
                         }
                     } else if(tcpModel.action == TcpAction.TimeAction.SYNC && tcpModel.type==TcpType.TIME){
@@ -1187,50 +1235,127 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
 
     private fun callControl(tcpModel: TcpModel) {
         if (tcpModel.action == TcpAction.SideAction.CALL) {
-            //显示分机呼叫信息
-            val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
-            updateBedCall(interactionVO, true)
+            Constant.callNums++
+            SerialPortHelper.setDoorLight(1, "200")
+        } else if (tcpModel.action == TcpAction.SideAction.SOS_CALL) {
+            SerialPortHelper.setDoorLight(1, "200")
+            Constant.sosOn = true
         } else if (tcpModel.action == TcpAction.SideAction.ACCEPT || tcpModel.action == TcpAction.SideAction.CANCEL) {
-            val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+            Constant.callNums--
+            if (Constant.callNums < 0) {
+                Constant.callNums = 0
+            }
+
+            //如果当前还有其他床位呼叫或者是紧急呼叫则不重置门灯
+            if (Constant.callNums == 0 && !Constant.sosOn) {
+                DoorLightHelper.resetDoorLight()
+            }
+
+        } else if (tcpModel.action == TcpAction.SideAction.SOS_CANCEL) {
+            Constant.sosOn = false
+
+            if (Constant.callNums == 0) {
+                DoorLightHelper.resetDoorLight()
+            }
+        }
+    }
+
+    private fun updateCallInfo(tcpModel: TcpModel) {
+        val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+        if (tcpModel.action == TcpAction.SideAction.SHOW) {
+            //显示呼叫信息
+            updateBedCall(interactionVO, true)
+        } else if (tcpModel.action == TcpAction.SideAction.CLEAR) {
+            //清除呼叫信息
             updateBedCall(interactionVO, false)
         }
     }
 
     //更新呼叫信息显示
     private fun updateBedCall(interactionVO: InteractionVO, add: Boolean) {
-        val name = CommonUtils.subStringAfter(interactionVO.fromFrameFullName, "-")
-        val frameName = Util.appendSpace(interactionVO.fromFrameFullName.replace("-", ","))
-        if (add) {
-            bedCalls.add(name)
-            if (Constant.TTS_STATUS == 2) {
-                SpeechUtil.getInstance().addSpeech(frameName + "呼叫", false)
+        try {
+            val bedName = CommonUtils.subStringAfter(interactionVO.fromFrameFullName, "-")
+            val roomName = CommonUtils.subStringBefore(interactionVO.fromFrameFullName, "-")
+            var showText = "$bedName 呼叫"
+            if (interactionVO.actionType == TcpType.SOS.name) {
+                //紧急呼叫
+                if (!TextUtils.isEmpty(interactionVO.data)) {
+                    showText = interactionVO.data
+                } else {
+                    showText = "$roomName 紧急呼叫"
+                }
             }
-        } else {
-            bedCalls.remove(name)
-            if (Constant.TTS_STATUS == 2) {
-                SpeechUtil.getInstance().removeSpeak(frameName + "呼叫")
+
+            if (add) {
+                val item = CallingItem(System.currentTimeMillis(), showText)
+                bedCalls.add(item)
+            } else {
+                if (bedCalls.size > 0) {
+                    val iterator = bedCalls.iterator()
+                    while (iterator.hasNext()) {
+                        val it = iterator.next()
+                        if (it.text == showText) {
+                            iterator.remove()
+                        }
+                    }
+                }
+            }
+
+            showCalls()
+        } catch (ex: Exception) {
+            ex.printStackTrace()
+        }
+    }
+
+    private fun showCalls() {
+        synchronized(Unit) {
+            if (bedCalls.size > 0) {
+                view_flipper.removeAllViews()
+                for ((index, e) in bedCalls.withIndex()) {
+                    val textView = TextView(activity)
+                    textView.text = e.text
+                    textView.setSingleLine(true)
+                    textView.setEllipsize(TextUtils.TruncateAt.END)
+                    textView.setTextColor(Color.RED)
+                    textView.textSize = 44f
+                    textView.gravity = (Gravity.END or Gravity.CENTER)
+                    //textView.getPaint().setFlags(mFlags);//字体划线
+                    //textView.setTypeface(null, mTypeface);//字体样式
+
+                    view_flipper.addView(textView, index)
+                }
+            } else {
+                view_flipper.removeAllViews()
             }
         }
+    }
 
-        if (bedCalls.size > 0) {
-            view_flipper.removeAllViews()
-            for ((index, e) in bedCalls.withIndex()) {
-                val textView = TextView(activity)
-                textView.text = e + " 呼叫"
-                textView.setSingleLine(true)
-                textView.setEllipsize(TextUtils.TruncateAt.END)
-                textView.setTextColor(Color.RED)
-                if ("rk3288".equals(Build.MODEL) || "rk3368".equals(Build.MODEL) || "WDMK_I".equals(Build.MODEL) || "WDMKI".equals(Build.MODEL)) {
-                    textView.textSize = 48f
-                } else {
-                    textView.textSize = 32f
+    private fun checkCalls() {
+        //5分钟无人处理自动清除
+        try {
+            var update = false
+            if (bedCalls.size > 0) {
+                val iterator = bedCalls.iterator()
+                while (iterator.hasNext()) {
+                    val it = iterator.next()
+                    if (System.currentTimeMillis() - it.time >= 30 * 60 * 1000) {
+                        iterator.remove()
+                        update = true
+                    }
+                }
+
+                if (update) {
+                    runOnUiThread {
+                        showCalls()
+                    }
                 }
-                textView.gravity = (Gravity.END or Gravity.CENTER)
+            } else {
+                Constant.callNums = 0
+                DoorLightHelper.resetDoorLight()
 
-                view_flipper.addView(textView, index)
             }
-        } else {
-            view_flipper.removeAllViews()
+        } catch (ex: Exception) {
+            ex.printStackTrace()
         }
     }
 

+ 134 - 281
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/adapter/FrameRoomAdapter.kt

@@ -3,13 +3,15 @@ package com.wdkl.app.ncs.callingdoor.adapter
 import android.content.Context
 import android.graphics.Color
 import android.graphics.drawable.Drawable
-import android.os.Build
 import android.support.v7.widget.RecyclerView
 import android.text.TextUtils
 import android.util.Log
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import android.view.animation.AlphaAnimation
+import android.view.animation.Animation
+import android.view.animation.LinearInterpolator
 import android.widget.ImageView
 import android.widget.LinearLayout
 import android.widget.TextView
@@ -24,62 +26,39 @@ class FrameRoomAdapter : RecyclerView.Adapter<FrameRoomAdapter.BedViewHolder> {
     private var context: Context
     private var data: ArrayList<FrameBedVO>
     private var configList = ArrayList<NurseConfigDto>()
+    private var flickBedNames = ArrayList<String>()
 
     private var drawableMale: Drawable
     private var drawableFemale: Drawable
     private var drawableEmpty: Drawable
-    private var iconMale: Drawable
-    private var iconFemale: Drawable
+    //private var iconMale: Drawable
+    //private var iconFemale: Drawable
 
     constructor(context: Context, data: ArrayList<FrameBedVO>) {
         this.context = context
         this.data = data
 
-        if ("rk3288".equals(Build.MODEL)) {
-            drawableEmpty = context.resources.getDrawable(R.mipmap.ic_custom_empty2)
-            drawableEmpty.setBounds(0, 0, drawableEmpty.minimumWidth, drawableEmpty.minimumHeight)
-            drawableMale = context.resources.getDrawable(R.mipmap.ic_custom_male2)
-            drawableMale.setBounds(0, 0, drawableMale.minimumWidth, drawableMale.minimumHeight)
-            drawableFemale = context.resources.getDrawable(R.mipmap.ic_custom_female2)
-            drawableFemale.setBounds(0, 0, drawableFemale.minimumWidth, drawableFemale.minimumHeight)
-            iconMale = context.resources.getDrawable(R.mipmap.ic_gender_male2)
-            iconMale.setBounds(0, 0, iconMale.minimumWidth, iconMale.minimumHeight)
-            iconFemale = context.resources.getDrawable(R.mipmap.ic_gender_female2)
-            iconFemale.setBounds(0, 0, iconFemale.minimumWidth, iconFemale.minimumHeight)
-        } else {
-            drawableEmpty = context.resources.getDrawable(R.mipmap.ic_custom_empty)
-            drawableEmpty.setBounds(0, 0, drawableEmpty.minimumWidth, drawableEmpty.minimumHeight)
-            drawableMale = context.resources.getDrawable(R.mipmap.ic_custom_male)
-            drawableMale.setBounds(0, 0, drawableMale.minimumWidth, drawableMale.minimumHeight)
-            drawableFemale = context.resources.getDrawable(R.mipmap.ic_custom_female)
-            drawableFemale.setBounds(0, 0, drawableFemale.minimumWidth, drawableFemale.minimumHeight)
-            iconMale = context.resources.getDrawable(R.mipmap.ic_gender_male)
-            iconMale.setBounds(0, 0, iconMale.minimumWidth, iconMale.minimumHeight)
-            iconFemale = context.resources.getDrawable(R.mipmap.ic_gender_female)
-            iconFemale.setBounds(0, 0, iconFemale.minimumWidth, iconFemale.minimumHeight)
-        }
+        drawableEmpty = context.resources.getDrawable(R.mipmap.ic_custom_empty)
+        drawableEmpty.setBounds(0, 0, drawableEmpty.minimumWidth, drawableEmpty.minimumHeight)
+        drawableMale = context.resources.getDrawable(R.mipmap.ic_custom_male)
+        drawableMale.setBounds(0, 0, drawableMale.minimumWidth, drawableMale.minimumHeight)
+        drawableFemale = context.resources.getDrawable(R.mipmap.ic_custom_female)
+        drawableFemale.setBounds(0, 0, drawableFemale.minimumWidth, drawableFemale.minimumHeight)
+        //iconMale = context.resources.getDrawable(R.mipmap.ic_gender_male)
+        //iconMale.setBounds(0, 0, iconMale.minimumWidth, iconMale.minimumHeight)
+        //iconFemale = context.resources.getDrawable(R.mipmap.ic_gender_female)
+        //iconFemale.setBounds(0, 0, iconFemale.minimumWidth, iconFemale.minimumHeight)
     }
 
     override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BedViewHolder {
-        if ("rk3288".equals(Build.MODEL)) {
-            val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_bed_rk3288, parent, false)
-            return BedViewHolder(view)
-        } else {
-            val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_bed, parent, false)
-            return BedViewHolder(view)
-        }
+        val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_bed, parent, false)
+        return BedViewHolder(view)
     }
 
     override fun onBindViewHolder(holder: BedViewHolder, position: Int) {
         try {
-            initDefaultNursingConfigs()
             val pos = position % data.size
-
-            if ("rk3288".equals(Build.MODEL)) {
-                showBedInfoRk3288(holder, data.get(pos))
-            } else {
-                showBedInfo(holder, data.get(pos))
-            }
+            showBedInfo(holder, data.get(pos))
         } catch (e: Exception) {
             e.printStackTrace()
         }
@@ -98,265 +77,153 @@ class FrameRoomAdapter : RecyclerView.Adapter<FrameRoomAdapter.BedViewHolder> {
         notifyDataSetChanged()
     }
 
-    private fun initDefaultNursingConfigs() {
-        //初始化默认护理项
-        configList.clear()
-        for (index in 1..5) {
-            var item = NurseConfigDto()
-            item.nurseConfigName = "暂无"
-            item.nurseOptionName = "暂无"
-            item.nurseColorRbg = "D7D7D7"
-            configList.add(item)
-        }
-    }
-
     private fun showBedInfo(holder: BedViewHolder, bedVO: FrameBedVO) {
-        holder.bedName.text = CommonUtils.subStringAfter(bedVO.frameBed.fullName, "-")
-        if (TextUtils.isEmpty(bedVO.customerName)) {
-            //空床位
-            holder.customName.text = "暂无"
-            holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
-            holder.customAge.visibility = View.GONE
-            holder.doctorIcon.visibility = View.GONE
-            holder.doctorTitle.visibility = View.GONE
-            holder.doctorName.visibility = View.GONE
-            holder.nurseIcon.visibility = View.GONE
-            holder.nurseTitle.visibility = View.GONE
-            holder.nurseName.visibility = View.GONE
-        } else {
-            //有入住
-            holder.customName.text = bedVO.customerName
-            holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
-            holder.customAge.visibility = View.VISIBLE
-            holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
-            if (bedVO.customerSex == 0) {
-                holder.customName.setCompoundDrawables(null, drawableFemale, null, null)
-                holder.customAge.setCompoundDrawables(iconFemale, null, null, null)
-            } else if (bedVO.customerSex == 1) {
-                holder.customName.setCompoundDrawables(null, drawableMale, null, null)
-                holder.customAge.setCompoundDrawables(iconMale, null, null, null)
-            } else {
-                holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
-                holder.customAge.setCompoundDrawables(null, null, null, null)
-            }
-            holder.doctorName.text = bedVO.doctorName
-            holder.nurseName.text = bedVO.nurseName
-
-            if (!TextUtils.isEmpty(Constant.doctorTitle)) {
-                holder.doctorTitle.text = Constant.doctorTitle
+        try {
+            val name = CommonUtils.subStringAfter(bedVO.frameBed.fullName, "-")
+            holder.bedName.text = name
+            if (TextUtils.isEmpty(bedVO.cardNo)) {
+                holder.cardNo.text = ""
             } else {
-                holder.doctorTitle.text = "责任医生"
+                holder.cardNo.text = "住院号: " + bedVO.cardNo
             }
 
-            if (!TextUtils.isEmpty(Constant.nurseTitle)) {
-                holder.nurseTitle.text = Constant.nurseTitle
+            //检查是否有呼叫,更新背景动画效果
+            if (flickBedNames.contains(name)) {
+                Log.e("showBed", "show animator: $name")
+                holder.bedItem.setBackgroundResource(R.color.bed_light_color)
+                holder.bedName.setTextColor(Color.parseColor("#FFFD3B30"))
+                startAnimator(holder.bedName)
             } else {
-                holder.nurseTitle.text = "责任护士"
+                Log.e("showBed", "clear animator: $name")
+                holder.bedItem.setBackgroundResource(R.color.white)
+                holder.bedName.setTextColor(Color.parseColor("#2F9DF1"))
+                clearAnimator(holder.bedName)
             }
 
-            if (Constant.doctorValid == 1) {
-                holder.doctorIcon.visibility = View.VISIBLE
-                holder.doctorTitle.visibility = View.VISIBLE
-                holder.doctorName.visibility = View.VISIBLE
-            } else {
+            if (TextUtils.isEmpty(bedVO.customerName)) {
+                //空床位
+                holder.customName.setText("空床位")
+                holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
+                holder.customAge.visibility = View.GONE
                 holder.doctorIcon.visibility = View.GONE
                 holder.doctorTitle.visibility = View.GONE
                 holder.doctorName.visibility = View.GONE
-            }
-
-            if (Constant.nurseValid == 1) {
-                holder.nurseIcon.visibility = View.VISIBLE
-                holder.nurseTitle.visibility = View.VISIBLE
-                holder.nurseName.visibility = View.VISIBLE
-            } else {
                 holder.nurseIcon.visibility = View.GONE
                 holder.nurseTitle.visibility = View.GONE
                 holder.nurseName.visibility = View.GONE
-            }
-
-            val nursingConfigs = bedVO.nurseConfigDtos
-            if (nursingConfigs != null && nursingConfigs.size > 0) {
-                for ((index, e) in nursingConfigs.withIndex()) {
-                    configList.set(index, e)
-                }
-            }
-        }
-
-
-        if (TextUtils.isEmpty(configList[0].nurseColorRbg)) {
-            holder.nursingColor1.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor1.setBackgroundColor(Color.parseColor("#" + configList[0].nurseColorRbg))
-        }
-        holder.nursingName1.setText(configList[0].nurseConfigName)
-        holder.nursingValue1.setText(configList[0].nurseOptionName)
-
-        if (TextUtils.isEmpty(configList[1].nurseColorRbg)) {
-            holder.nursingColor2.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor2.setBackgroundColor(Color.parseColor("#" + configList[1].nurseColorRbg))
-        }
-        holder.nursingName2.setText(configList[1].nurseConfigName)
-        holder.nursingValue2.setText(configList[1].nurseOptionName)
-
-        if (TextUtils.isEmpty(configList[2].nurseColorRbg)) {
-            holder.nursingColor3.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor3.setBackgroundColor(Color.parseColor("#" + configList[2].nurseColorRbg))
-        }
-        holder.nursingName3.setText(configList[2].nurseConfigName)
-        holder.nursingValue3.setText(configList[2].nurseOptionName)
-
-        if (TextUtils.isEmpty(configList[3].nurseColorRbg)) {
-            holder.nursingColor4.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor4.setBackgroundColor(Color.parseColor("#" + configList[3].nurseColorRbg))
-        }
-        holder.nursingName4.setText(configList[3].nurseConfigName)
-        holder.nursingValue4.setText(configList[3].nurseOptionName)
-
-        if (TextUtils.isEmpty(configList[4].nurseColorRbg)) {
-            holder.nursingColor5.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor5.setBackgroundColor(Color.parseColor("#" + configList[4].nurseColorRbg))
-        }
-        holder.nursingName5.setText(configList[4].nurseConfigName)
-        holder.nursingValue5.setText(configList[4].nurseOptionName)
-    }
-
-    private fun showBedInfoRk3288(holder: BedViewHolder, bedVO: FrameBedVO) {
-        holder.bedName.text = CommonUtils.subStringAfter(bedVO.frameBed.fullName, "-")
-        if (TextUtils.isEmpty(bedVO.customerName)) {
-            //空床位
-            holder.customName.text = "暂无"
-            holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
-            holder.customAge.visibility = View.GONE
-            holder.doctorIcon.visibility = View.GONE
-            holder.doctorTitle.visibility = View.GONE
-            holder.doctorName.visibility = View.GONE
-            holder.nurseIcon.visibility = View.GONE
-            holder.nurseTitle.visibility = View.GONE
-            holder.nurseName.visibility = View.GONE
-        } else {
-            //有入住
-            holder.customName.text = bedVO.customerName
-            holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
-            holder.customAge.visibility = View.VISIBLE
-            holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
-            if (bedVO.customerSex == 0) {
-                holder.customName.setCompoundDrawables(drawableFemale, null, null, null)
-                holder.customAge.setCompoundDrawables(iconFemale, null, null, null)
-            } else if (bedVO.customerSex == 1) {
-                holder.customName.setCompoundDrawables(drawableMale, null, null, null)
-                holder.customAge.setCompoundDrawables(iconMale, null, null, null)
             } else {
+                //有入住
+                holder.customName.text = bedVO.customerName
                 holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
-                holder.customAge.setCompoundDrawables(null, null, null, null)
-            }
-            holder.doctorName.text = bedVO.doctorName
-            holder.nurseName.text = bedVO.nurseName
-
-            if (!TextUtils.isEmpty(Constant.doctorTitle)) {
-                holder.doctorTitle.text = Constant.doctorTitle
-            } else {
-                holder.doctorTitle.text = "责任医生"
-            }
+                holder.customAge.visibility = View.VISIBLE
+                //holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
+                if (bedVO.customerSex == 0) {
+                    holder.customName.setCompoundDrawables(drawableFemale, null, null, null)
+                    //holder.customAge.setCompoundDrawables(iconFemale, null, null, null)
+                    holder.customAge.text = "男 " + bedVO.customerAge + bedVO.customerAgeUnit
+                } else if (bedVO.customerSex == 1) {
+                    holder.customName.setCompoundDrawables(drawableMale, null, null, null)
+                    //holder.customAge.setCompoundDrawables(iconMale, null, null, null)
+                    holder.customAge.text = "女 " + bedVO.customerAge + bedVO.customerAgeUnit
+                } else {
+                    holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
+                    //holder.customAge.setCompoundDrawables(null, null, null, null)
+                    holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
+                }
+                holder.doctorName.text = bedVO.doctorName
+                holder.nurseName.text = bedVO.nurseName
 
-            if (!TextUtils.isEmpty(Constant.nurseTitle)) {
-                holder.nurseTitle.text = Constant.nurseTitle
-            } else {
-                holder.nurseTitle.text = "责任护士"
-            }
+                if (!TextUtils.isEmpty(Constant.doctorTitle)) {
+                    holder.doctorTitle.text = Constant.doctorTitle
+                } else {
+                    holder.doctorTitle.setText("责任医生")
+                }
 
-            if (Constant.doctorValid == 1) {
-                holder.doctorIcon.visibility = View.VISIBLE
-                holder.doctorTitle.visibility = View.VISIBLE
-                holder.doctorName.visibility = View.VISIBLE
-            } else {
-                holder.doctorIcon.visibility = View.GONE
-                holder.doctorTitle.visibility = View.GONE
-                holder.doctorName.visibility = View.GONE
-            }
+                if (!TextUtils.isEmpty(Constant.nurseTitle)) {
+                    holder.nurseTitle.text = Constant.nurseTitle
+                } else {
+                    holder.nurseTitle.setText("责任护士")
+                }
 
-            if (Constant.nurseValid == 1) {
-                holder.nurseIcon.visibility = View.VISIBLE
-                holder.nurseTitle.visibility = View.VISIBLE
-                holder.nurseName.visibility = View.VISIBLE
-            } else {
-                holder.nurseIcon.visibility = View.GONE
-                holder.nurseTitle.visibility = View.GONE
-                holder.nurseName.visibility = View.GONE
-            }
+                if (Constant.doctorValid == 1) {
+                    //holder.doctorIcon.visibility = View.VISIBLE
+                    holder.doctorTitle.visibility = View.VISIBLE
+                    holder.doctorName.visibility = View.VISIBLE
+                } else {
+                    //holder.doctorIcon.visibility = View.GONE
+                    holder.doctorTitle.visibility = View.GONE
+                    holder.doctorName.visibility = View.GONE
+                }
 
-            val nursingConfigs = bedVO.nurseConfigDtos
-            if (nursingConfigs != null && nursingConfigs.size > 0) {
-                for ((index, e) in nursingConfigs.withIndex()) {
-                    configList.set(index, e)
+                if (Constant.nurseValid == 1) {
+                    //holder.nurseIcon.visibility = View.VISIBLE
+                    holder.nurseTitle.visibility = View.VISIBLE
+                    holder.nurseName.visibility = View.VISIBLE
+                } else {
+                    //holder.nurseIcon.visibility = View.GONE
+                    holder.nurseTitle.visibility = View.GONE
+                    holder.nurseName.visibility = View.GONE
                 }
             }
+        } catch (e: Exception) {
+            e.printStackTrace()
         }
+    }
 
+    private fun startAnimator(view: View) {
+        /*val animator: ValueAnimator = ObjectAnimator.ofInt(view, "backgroundColor", 0x22ff0000, 0x77ff0000) //对背景色颜色进行改变,操作的属性为"backgroundColor",此处必须这样写,不能全小写,后面的颜色为在对应颜色间进行渐变
+        animator.duration = 1500
+        animator.repeatCount = ValueAnimator.INFINITE //表示重复多次
+        animator.repeatMode = ValueAnimator.REVERSE //表示动画结束后,反过来再执行;RESTART表示从头开始,REVERSE表示从末尾倒播
+        animator.setEvaluator(ArgbEvaluator()) //如果要颜色渐变必须要ArgbEvaluator,来实现颜色之间的平滑变化,否则会出现颜色不规则跳动
+        animator.start()*/
+
+
+        val alphaAnimation = AlphaAnimation(1.0f, 0.1f)
+        alphaAnimation.duration = 1500
+        alphaAnimation.interpolator = LinearInterpolator()
+        alphaAnimation.repeatCount = Animation.INFINITE //表示重复多次
+        alphaAnimation.repeatMode = Animation.REVERSE //表示动画结束后,反过来再执行;RESTART表示从头开始,REVERSE表示从末尾倒播
+        view.startAnimation(alphaAnimation)
+    }
 
-        if (TextUtils.isEmpty(configList[0].nurseColorRbg)) {
-            holder.nursingColor1.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor1.setBackgroundColor(Color.parseColor("#" + configList[0].nurseColorRbg))
-        }
-        holder.nursingName1.setText(configList[0].nurseConfigName)
-        holder.nursingValue1.setText(configList[0].nurseOptionName)
-
-        if (TextUtils.isEmpty(configList[1].nurseColorRbg)) {
-            holder.nursingColor2.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor2.setBackgroundColor(Color.parseColor("#" + configList[1].nurseColorRbg))
-        }
-        holder.nursingName2.setText(configList[1].nurseConfigName)
-        holder.nursingValue2.setText(configList[1].nurseOptionName)
+    private fun clearAnimator(view: View) {
+        view.clearAnimation()
+    }
 
-        if (TextUtils.isEmpty(configList[2].nurseColorRbg)) {
-            holder.nursingColor3.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor3.setBackgroundColor(Color.parseColor("#" + configList[2].nurseColorRbg))
+    fun addFlickBedItem(name: String) {
+        synchronized(flickBedNames) {
+            flickBedNames.add(name)
+            notifyDataSetChanged()
         }
-        holder.nursingName3.setText(configList[2].nurseConfigName)
-        holder.nursingValue3.setText(configList[2].nurseOptionName)
+    }
 
-        if (TextUtils.isEmpty(configList[3].nurseColorRbg)) {
-            holder.nursingColor4.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor4.setBackgroundColor(Color.parseColor("#" + configList[3].nurseColorRbg))
+    fun removeFlickBedItem(name: String) {
+        synchronized(flickBedNames) {
+            if (flickBedNames.size > 0) {
+                val iterator = flickBedNames.iterator()
+                while (iterator.hasNext()) {
+                    val it = iterator.next()
+                    if (it == name) {
+                        iterator.remove()
+                    }
+                }
+            }
+            notifyDataSetChanged()
         }
-        holder.nursingName4.setText(configList[3].nurseConfigName)
-        holder.nursingValue4.setText(configList[3].nurseOptionName)
+    }
 
-        if (TextUtils.isEmpty(configList[4].nurseColorRbg)) {
-            holder.nursingColor5.setBackgroundColor(Color.parseColor("#D7D7D7"))
-        } else {
-            holder.nursingColor5.setBackgroundColor(Color.parseColor("#" + configList[4].nurseColorRbg))
+    fun resetFlickBedItems() {
+        synchronized(flickBedNames) {
+            flickBedNames.clear()
+            notifyDataSetChanged()
         }
-        holder.nursingName5.setText(configList[4].nurseConfigName)
-        holder.nursingValue5.setText(configList[4].nurseOptionName)
     }
 
     class BedViewHolder: RecyclerView.ViewHolder {
+        var bedItem : LinearLayout
         var bedName : TextView
-        var nursingColor1 : View
-        var nursingName1 : TextView
-        var nursingValue1 : TextView
-        var nursingColor2 : View
-        var nursingName2 : TextView
-        var nursingValue2 : TextView
-        var nursingColor3 : View
-        var nursingName3 : TextView
-        var nursingValue3 : TextView
-        var nursingColor4 : View
-        var nursingName4 : TextView
-        var nursingValue4 : TextView
-        var nursingColor5 : View
-        var nursingName5 : TextView
-        var nursingValue5 : TextView
-        var nursingView : LinearLayout
-
+        var cardNo : TextView
 
         var customName : TextView
         var customAge : TextView
@@ -368,23 +235,9 @@ class FrameRoomAdapter : RecyclerView.Adapter<FrameRoomAdapter.BedViewHolder> {
         var nurseName : TextView
 
         constructor(itemView: View): super(itemView) {
+            bedItem = itemView.findViewById(R.id.ll_item_bed)
             bedName = itemView.findViewById(R.id.tv_bed_name_title)
-            nursingColor1 = itemView.findViewById(R.id.nurse_config_item_color1)
-            nursingName1 = itemView.findViewById(R.id.nurse_config_item_name1)
-            nursingValue1 = itemView.findViewById(R.id.nurse_config_item_value1)
-            nursingColor2 = itemView.findViewById(R.id.nurse_config_item_color2)
-            nursingName2 = itemView.findViewById(R.id.nurse_config_item_name2)
-            nursingValue2 = itemView.findViewById(R.id.nurse_config_item_value2)
-            nursingColor3 = itemView.findViewById(R.id.nurse_config_item_color3)
-            nursingName3 = itemView.findViewById(R.id.nurse_config_item_name3)
-            nursingValue3 = itemView.findViewById(R.id.nurse_config_item_value3)
-            nursingColor4 = itemView.findViewById(R.id.nurse_config_item_color4)
-            nursingName4 = itemView.findViewById(R.id.nurse_config_item_name4)
-            nursingValue4 = itemView.findViewById(R.id.nurse_config_item_value4)
-            nursingColor5 = itemView.findViewById(R.id.nurse_config_item_color5)
-            nursingName5 = itemView.findViewById(R.id.nurse_config_item_name5)
-            nursingValue5 = itemView.findViewById(R.id.nurse_config_item_value5)
-            nursingView = itemView.findViewById(R.id.ll_nurse_configs)
+            cardNo = itemView.findViewById(R.id.tv_bed_card_no)
 
             customName = itemView.findViewById(R.id.bed_customer_name)
             customAge = itemView.findViewById(R.id.bed_customer_age)

+ 27 - 0
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/bean/CallingItem.java

@@ -0,0 +1,27 @@
+package com.wdkl.app.ncs.callingdoor.bean;
+
+public class CallingItem {
+    private long time;
+    private String text;
+
+    public CallingItem(long time, String text) {
+        this.time = time;
+        this.text = text;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+}

+ 27 - 9
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/fragment/MainFragment.kt

@@ -4,6 +4,7 @@ import android.os.Build
 import android.support.v7.widget.DefaultItemAnimator
 import android.support.v7.widget.GridLayoutManager
 import com.enation.javashop.net.engine.model.NetState
+import com.google.gson.Gson
 import com.wdkl.app.ncs.callingdoor.R
 import com.wdkl.app.ncs.callingdoor.adapter.FrameRoomAdapter
 import com.wdkl.app.ncs.callingdoor.databinding.MainViewLayoutBinding
@@ -20,6 +21,10 @@ import com.wdkl.ncs.android.middleware.logic.contract.callingdoor.MainFragmentCo
 import com.wdkl.ncs.android.middleware.logic.presenter.callingdoor.MainFragmentPresenter
 import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO
 import com.wdkl.ncs.android.middleware.model.vo.FrameRoomVO
+import com.wdkl.ncs.android.middleware.model.vo.InteractionVO
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
+import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
+import com.wdkl.ncs.android.middleware.utils.CommonUtils
 import kotlinx.android.synthetic.main.main_view_layout.*
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
@@ -29,7 +34,7 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
     val TAG = "MainFragment"
 
     private lateinit var gridLayoutManager: OnegoGridLayoutManager
-    private lateinit var roomAdpter : FrameRoomAdapter
+    private lateinit var roomAdapter : FrameRoomAdapter
     private var bedList = ArrayList<FrameBedVO>()
 
     override fun getLayId(): Int {
@@ -41,14 +46,10 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
     }
 
     override fun init() {
-        if ("rk3288".equals(Build.MODEL)) {
-            gridLayoutManager = OnegoGridLayoutManager(activity, 1, GridLayoutManager.VERTICAL, false)
-        } else {
-            gridLayoutManager = OnegoGridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
-        }
-        roomAdpter = FrameRoomAdapter(activity, bedList)
+        gridLayoutManager = OnegoGridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false)
+        roomAdapter = FrameRoomAdapter(activity, bedList)
         rv_bed_view.layoutManager = gridLayoutManager
-        rv_bed_view.adapter = roomAdpter
+        rv_bed_view.adapter = roomAdapter
 
         updateInfo()
     }
@@ -63,7 +64,7 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
         if (roomInfo.frameBedList != null) {
             bedList.clear()
             bedList.addAll(roomInfo.frameBedList)
-            roomAdpter.setData(bedList)
+            roomAdapter.setData(bedList)
             Utils.setInBedVos(bedList)
             rv_bed_view.itemAnimator = DefaultItemAnimator()
             if (bedList.size > 3) {
@@ -127,6 +128,23 @@ class MainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>()
             Constant.EVENT_UPDATE_CUSTOM -> {
                 updateInfo()
             }
+
+            Constant.EVENT_TCP_MSG -> {
+                val tcpModel = messageEvent.message as TcpModel
+                if (tcpModel.action == TcpAction.SideAction.SHOW || tcpModel.action == TcpAction.SideAction.CLEAR) {
+                    val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
+                    val bedName = CommonUtils.subStringAfter(interactionVO.fromFrameFullName, "-")
+                    if (tcpModel.action == TcpAction.SideAction.SHOW) {
+                        roomAdapter.addFlickBedItem(bedName)
+                    } else {
+                        roomAdapter.removeFlickBedItem(bedName)
+                    }
+                }
+            }
+
+            Constant.EVENT_CLEAR_CALLS -> {
+                roomAdapter.resetFlickBedItems()
+            }
         }
     }
 }

+ 23 - 1
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/helper/DoorLightHelper.java

@@ -1,5 +1,7 @@
 package com.wdkl.app.ncs.callingdoor.helper;
 
+import com.wdkl.app.ncs.callingdoor.settings.SettingConfig;
+import com.wdkl.ncs.android.lib.base.BaseApplication;
 import com.wdkl.ncs.android.middleware.common.Constant;
 import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel;
 import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction;
@@ -11,6 +13,10 @@ public class DoorLightHelper {
             || TcpAction.SideAction.SOS_CALL == tcpModel.getAction()) {
             //门灯红色闪烁
             SerialPortHelper.setDoorLight(1, "200"); //红色闪烁
+
+            if (TcpAction.SideAction.SOS_CALL == tcpModel.getAction()) {
+                Constant.sosOn = true;
+            }
         } else if (TcpAction.SideAction.ACCEPT == tcpModel.getAction()
             || TcpAction.SideAction.CANCEL == tcpModel.getAction()
             || TcpAction.SideAction.SOS_CANCEL == tcpModel.getAction()) {
@@ -18,8 +24,24 @@ public class DoorLightHelper {
             if (Constant.inNursing) {
                 SerialPortHelper.setDoorLight(1, Constant.nursingColor); //绿色
             } else {
-                SerialPortHelper.setDoorLight(1, "111"); //白色
+                //SerialPortHelper.setDoorLight(1, "111"); //白色
+                resetDoorLight();
+            }
+
+            if (TcpAction.SideAction.SOS_CANCEL == tcpModel.getAction()) {
+                Constant.sosOn = false;
             }
         }
     }
+
+    public static void resetDoorLight() {
+        //有人入住时点亮门灯,无人入住关闭门灯
+        Constant.inNursing = SettingConfig.getInNursing(BaseApplication.appContext);
+        if (Constant.inNursing) {
+            SerialPortHelper.setDoorLight(1, Constant.nursingColor); //绿色
+        } else {
+            SerialPortHelper.setDoorLight(1, "111"); //白色
+
+        }
+    }
 }

+ 17 - 2
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/helper/SOSHelper.java

@@ -5,6 +5,8 @@ import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 
+import com.wdkl.app.ncs.callingdoor.settings.SettingConfig;
+import com.wdkl.ncs.android.lib.base.BaseApplication;
 import com.wdkl.ncs.android.middleware.common.Constant;
 import com.wdkl.ncs.android.middleware.tcp.channel.OtherUtil;
 
@@ -25,9 +27,12 @@ public class SOSHelper {
         if ("rk3128".equals(Build.MODEL) || "rk3368".equals(Build.MODEL) || "WDMK_I".equals(Build.MODEL) || "WDMKI".equals(Build.MODEL)) {
             SerialPortHelper.setSosLight("2");
             OtherUtil.sendSosCall(Constant.DEVICE_ID);
+            SerialPortHelper.setDoorLight(1, "200"); //红色闪烁
 
-            //60s之后紧急按钮灯自动复位
-            handler.sendEmptyMessageDelayed(110, 60000);
+            Constant.sosOn = true;
+
+            //5min之后紧急按钮灯自动复位
+            handler.sendEmptyMessageDelayed(110, 600000);
         }
     }
 
@@ -39,6 +44,16 @@ public class SOSHelper {
             } else {
                 SerialPortHelper.setSosLight("0");
             }
+
+            Constant.sosOn = false;
+
+            //如果当前在护理中则不操作门灯,如果不在护理中则重置门灯
+            if (Constant.inNursing) {
+                SerialPortHelper.setDoorLight(1, Constant.nursingColor); //绿色
+            } else {
+                //SerialPortHelper.setDoorLight(1, "111"); //白色
+                DoorLightHelper.resetDoorLight();
+            }
         }
     }
 }

+ 20 - 0
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/settings/SettingConfig.java

@@ -55,6 +55,26 @@ public class SettingConfig {
     //app上次启动时间
     private static final String KEY_SP_APP_START_TIME = "KEY_SP_APP_START_TIME";
 
+    //护理状态
+    private static final String KEY_IN_NURSING = "KEY_IN_NURSING";
+    private static final String KEY_NURSING_ID = "KEY_NURSING_ID";
+
+    public static boolean getInNursing(Context context) {
+        return getSP(context).getBoolean(KEY_IN_NURSING, false);
+    }
+
+    public static void setInNursing(Context context, boolean nursing) {
+        getEditor(context).putBoolean(KEY_IN_NURSING, nursing).apply();
+    }
+
+    public static int getNursingId(Context context) {
+        return getSP(context).getInt(KEY_NURSING_ID, -1);
+    }
+
+    public static void setNursingId(Context context, int nursingId) {
+        getEditor(context).putInt(KEY_NURSING_ID, nursingId).apply();
+    }
+
     /**
      * 获取白天亮度
      *

+ 12 - 0
callingdoor/src/main/res/drawable/shape_bed_item_bg.xml

@@ -0,0 +1,12 @@
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:left="-2dp"
+        android:right="-2dp"
+        android:top="-2dp">
+        <shape>
+            <stroke
+                android:width="2px"
+                android:color="@color/main_color"/>
+        </shape>
+    </item>
+</layer-list>

+ 2 - 1
callingdoor/src/main/res/layout/call_bed_dialog_lay.xml

@@ -2,7 +2,8 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@drawable/radis">
+    android:background="@drawable/radis"
+    android:padding="10dp">
 
     <Button
         android:id="@+id/button_cancel"

+ 126 - 98
callingdoor/src/main/res/layout/callingdoor_main_lay.xml

@@ -9,21 +9,41 @@
             android:id="@+id/activity_calling_door_layout_title"
             layout="@layout/view_title_layout"/>
 
+        <TextView
+            android:id="@+id/app_version"
+            android:layout_width="148dp"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_alignParentRight="true"
+            android:layout_marginTop="10dp"
+            android:layout_marginBottom="10dp"
+            android:gravity="center"
+            android:paddingTop="10dp"
+            android:paddingBottom="10dp"
+            android:text="--"
+            android:textColor="@color/main_color"
+            android:textSize="20sp" />
+
         <LinearLayout
             android:id="@+id/ll_room_name"
             android:layout_width="match_parent"
-            android:layout_height="100dp"
+            android:layout_height="154dp"
+            android:layout_marginLeft="20dp"
+            android:layout_marginRight="20dp"
             android:layout_below="@id/activity_calling_door_layout_title">
             <com.wdkl.ncs.android.lib.widget.MarqueeTextView
                 android:id="@+id/tv_room_name"
                 android:layout_width="0dp"
                 android:layout_height="match_parent"
-                android:layout_weight="3"
+                android:layout_marginTop="-10dp"
+                android:layout_weight="2.2"
                 android:paddingLeft="20dp"
                 android:paddingRight="20dp"
-                android:text="--房"
-                android:textColor="#EAF2F9"
-                android:textSize="68sp"
+                android:gravity="center_vertical"
+                android:text="--"
+                android:textColor="@color/main_color"
+                android:textSize="112sp"
+                android:textStyle="bold"
                 android:singleLine="true"
                 android:ellipsize="marquee"
                 android:focusable="true"
@@ -34,8 +54,6 @@
                 android:layout_width="0dp"
                 android:layout_height="match_parent"
                 android:layout_weight="1"
-                android:paddingRight="10dp"
-                android:paddingLeft="10dp"
                 android:autoStart="true"
                 android:flipInterval="5000"
                 android:inAnimation="@anim/slide_down_in"
@@ -52,108 +70,118 @@
         </LinearLayout>
 
         <!--右侧按钮区域-->
-        <RelativeLayout
-            android:id="@+id/rl_room_actions"
-            android:layout_width="128dp"
+        <ScrollView
+            android:id="@+id/room_actions"
+            android:layout_width="160dp"
             android:layout_height="match_parent"
-            android:layout_alignParentRight="true"
             android:layout_marginTop="10dp"
-            android:layout_marginRight="10dp"
-            android:layout_below="@id/ll_room_name">
-            <TextView
-                android:id="@+id/app_version"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_alignParentBottom="true"
-                android:layout_marginBottom="10dp"
-                android:paddingTop="10dp"
-                android:paddingBottom="10dp"
-                android:gravity="center"
-                android:text="版本"
-                android:textSize="18sp"
-                android:textColor="@color/main_color"/>
-            <TextView
-                android:id="@+id/room_action_nurse"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_above="@id/app_version"
-                android:layout_marginBottom="10dp"
-                android:background="@mipmap/bg_bottom_btn"
-                android:drawableLeft="@drawable/ic_nursing"
-                android:drawablePadding="6dp"
-                android:padding="10dp"
-                android:gravity="center_vertical"
-                android:text="进入护理"
-                android:textSize="18sp"
-                android:textColor="@drawable/selector_bottom_btn_text_color"/>
-            <TextView
-                android:id="@+id/room_action_support"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_above="@id/room_action_nurse"
-                android:layout_marginBottom="40dp"
-                android:background="@mipmap/bg_bottom_btn"
-                android:drawableLeft="@mipmap/ic_support"
-                android:drawablePadding="6dp"
-                android:padding="10dp"
-                android:gravity="center_vertical"
-                android:text="请求增援"
-                android:textSize="18sp"
-                android:textColor="@drawable/selector_bottom_btn_text_color"/>
-            <TextView
-                android:id="@+id/room_cancel_call"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_above="@id/room_action_support"
-                android:layout_marginBottom="40dp"
-                android:background="@mipmap/bg_bottom_btn"
-                android:drawableLeft="@mipmap/ic_call"
-                android:drawablePadding="6dp"
-                android:padding="10dp"
-                android:gravity="center_vertical"
-                android:text="取消呼叫"
-                android:textSize="18sp"
-                android:textColor="@drawable/selector_bottom_btn_text_color" />
-            <TextView
-                android:id="@+id/room_action_call"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_above="@id/room_cancel_call"
-                android:layout_marginBottom="24dp"
-                android:background="@mipmap/bg_bottom_btn"
-                android:drawableLeft="@mipmap/ic_call"
-                android:drawablePadding="6dp"
-                android:padding="10dp"
-                android:gravity="center_vertical"
-                android:text="呼叫护士"
-                android:textSize="18sp"
-                android:textColor="@drawable/selector_bottom_btn_text_color"
-                android:visibility="gone" />
-            <TextView
-                android:id="@+id/room_action_call_bed"
+            android:layout_below="@id/ll_room_name"
+            android:layout_above="@id/app_version"
+            android:layout_alignParentRight="true">
+
+            <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_above="@id/room_action_call"
-                android:layout_marginBottom="24dp"
-                android:background="@mipmap/bg_bottom_btn"
-                android:drawableLeft="@mipmap/ic_call"
-                android:drawablePadding="6dp"
-                android:padding="10dp"
-                android:gravity="center_vertical"
-                android:text="呼叫床位"
-                android:textSize="18sp"
-                android:textColor="@drawable/selector_bottom_btn_text_color"
-                android:visibility="gone" />
-        </RelativeLayout>
+                android:layout_marginRight="10dp"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/room_cancel_call"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="50dp"
+                    android:layout_marginBottom="40dp"
+                    android:background="@mipmap/bg_bottom_btn"
+                    android:drawableLeft="@mipmap/ic_call"
+                    android:drawablePadding="6dp"
+                    android:gravity="center_vertical"
+                    android:padding="10dp"
+                    android:singleLine="true"
+                    android:ellipsize="end"
+                    android:text="清除呼叫"
+                    android:textColor="@drawable/selector_bottom_btn_text_color"
+                    android:textSize="24sp" />
+
+                <TextView
+                    android:id="@+id/room_action_support"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="40dp"
+                    android:background="@mipmap/bg_bottom_btn"
+                    android:drawableLeft="@mipmap/ic_support"
+                    android:drawablePadding="6dp"
+                    android:gravity="center_vertical"
+                    android:padding="10dp"
+                    android:singleLine="true"
+                    android:ellipsize="end"
+                    android:text="请求增援"
+                    android:textColor="@drawable/selector_bottom_btn_text_color"
+                    android:textSize="24sp" />
+
+                <TextView
+                    android:id="@+id/room_action_nurse"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="40dp"
+                    android:background="@mipmap/bg_bottom_btn"
+                    android:drawableLeft="@drawable/ic_nursing"
+                    android:drawablePadding="6dp"
+                    android:gravity="center_vertical"
+                    android:padding="10dp"
+                    android:singleLine="true"
+                    android:ellipsize="end"
+                    android:text="进入护理"
+                    android:textColor="@color/white"
+                    android:textSize="24sp" />
+
+                <TextView
+                    android:id="@+id/room_action_call"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="30dp"
+                    android:background="@mipmap/bg_bottom_btn"
+                    android:drawableLeft="@mipmap/ic_call"
+                    android:drawablePadding="6dp"
+                    android:padding="10dp"
+                    android:gravity="center_vertical"
+                    android:singleLine="true"
+                    android:ellipsize="end"
+                    android:text="呼叫护士"
+                    android:textSize="24sp"
+                    android:textColor="@drawable/selector_bottom_btn_text_color"
+                    android:visibility="gone" />
+
+                <TextView
+                    android:id="@+id/room_action_call_bed"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="30dp"
+                    android:background="@mipmap/bg_bottom_btn"
+                    android:drawableLeft="@mipmap/ic_call"
+                    android:drawablePadding="6dp"
+                    android:padding="10dp"
+                    android:gravity="center_vertical"
+                    android:singleLine="true"
+                    android:ellipsize="end"
+                    android:text="呼叫床位"
+                    android:textSize="24sp"
+                    android:textColor="@drawable/selector_bottom_btn_text_color"
+                    android:visibility="gone" />
+
+            </LinearLayout>
+        </ScrollView>
 
         <!--床位fragment区域-->
         <FrameLayout
             android:id="@+id/callingdoor_main_frame"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_margin="10dp"
+            android:layout_marginBottom="10dp"
+            android:layout_marginLeft="20dp"
+            android:layout_marginRight="20dp"
+            android:padding="10dp"
             android:layout_below="@id/ll_room_name"
-            android:layout_toLeftOf="@id/rl_room_actions"/>
+            android:layout_toLeftOf="@id/room_actions"/>
 
         <!--通话界面-->
         <FrameLayout

+ 63 - 211
callingdoor/src/main/res/layout/item_bed.xml

@@ -1,227 +1,73 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="288dp"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/ll_item_bed"
+    android:layout_width="264dp"
     android:layout_height="match_parent"
-    android:paddingLeft="4dp"
-    android:orientation="vertical">
+    android:layout_marginLeft="4dp"
+    android:layout_marginRight="4dp"
+    android:background="@drawable/shape_bed_item_bg"
+    android:orientation="vertical"
+    android:gravity="center">
 
-    <TextView
+    <com.wdkl.ncs.android.lib.widget.MarqueeTextView
         android:id="@+id/tv_bed_name_title"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:padding="4dp"
-        android:text="-"
+        android:text="--"
         android:textColor="@color/main_color"
-        android:textSize="32sp"/>
+        android:textSize="60sp"
+        android:textStyle="bold"
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:focusable="true"
+        android:focusableInTouchMode="true"/>
+
+    <TextView
+        android:id="@+id/bed_customer_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="20dp"
+        android:drawableLeft="@mipmap/ic_custom_male"
+        android:drawablePadding="10dp"
+        android:gravity="center"
+        android:text="--"
+        android:textColor="@color/black"
+        android:textSize="36sp" />
+
+    <TextView
+        android:id="@+id/bed_customer_age"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:text="--"
+        android:textSize="24sp" />
+
+    <TextView
+        android:id="@+id/tv_bed_card_no"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:textSize="24sp"
+        android:text="--"/>
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:baselineAligned="false">
+        android:layout_marginTop="12dp">
 
-        <!--护理项-->
         <LinearLayout
-            android:id="@+id/ll_nurse_configs"
             android:layout_width="0dp"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:baselineAligned="false"
+            android:gravity="center"
             android:orientation="vertical">
-
-            <RelativeLayout
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/nurse_config_item_height"
-                android:layout_marginTop="10dp">
-                <View
-                    android:id="@+id/nurse_config_item_color1"
-                    android:layout_width="10dp"
-                    android:layout_height="match_parent"
-                    android:background="@color/nursing_default_color"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_name1"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color1"
-                    android:paddingLeft="4dp"
-                    android:text="暂无"
-                    android:textColor="@color/text_name_color"
-                    android:textSize="@dimen/nurse_config_title_font"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_value1"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color1"
-                    android:layout_alignParentBottom="true"
-                    android:paddingRight="4dp"
-                    android:gravity="right"
-                    android:text="暂无"
-                    android:textColor="@color/main_color"
-                    android:textSize="@dimen/nurse_config_value_font"/>
-            </RelativeLayout>
-
-            <RelativeLayout
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/nurse_config_item_height"
-                android:layout_marginTop="20dp">
-                <View
-                    android:id="@+id/nurse_config_item_color2"
-                    android:layout_width="10dp"
-                    android:layout_height="match_parent"
-                    android:background="@color/nursing_default_color"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_name2"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color2"
-                    android:paddingLeft="4dp"
-                    android:text="暂无"
-                    android:textColor="@color/text_name_color"
-                    android:textSize="@dimen/nurse_config_title_font"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_value2"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color2"
-                    android:layout_alignParentBottom="true"
-                    android:paddingRight="4dp"
-                    android:gravity="right"
-                    android:text="暂无"
-                    android:textColor="@color/main_color"
-                    android:textSize="@dimen/nurse_config_value_font"/>
-            </RelativeLayout>
-
-            <RelativeLayout
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/nurse_config_item_height"
-                android:layout_marginTop="20dp">
-                <View
-                    android:id="@+id/nurse_config_item_color3"
-                    android:layout_width="10dp"
-                    android:layout_height="match_parent"
-                    android:background="@color/nursing_default_color"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_name3"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color3"
-                    android:paddingLeft="4dp"
-                    android:text="暂无"
-                    android:textColor="@color/text_name_color"
-                    android:textSize="@dimen/nurse_config_title_font"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_value3"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color3"
-                    android:layout_alignParentBottom="true"
-                    android:paddingRight="4dp"
-                    android:gravity="right"
-                    android:text="暂无"
-                    android:textColor="@color/main_color"
-                    android:textSize="@dimen/nurse_config_value_font"/>
-            </RelativeLayout>
-
-            <RelativeLayout
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/nurse_config_item_height"
-                android:layout_marginTop="20dp">
-                <View
-                    android:id="@+id/nurse_config_item_color4"
-                    android:layout_width="10dp"
-                    android:layout_height="match_parent"
-                    android:background="@color/nursing_default_color"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_name4"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color4"
-                    android:paddingLeft="4dp"
-                    android:text="暂无"
-                    android:textColor="@color/text_name_color"
-                    android:textSize="@dimen/nurse_config_title_font"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_value4"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color4"
-                    android:layout_alignParentBottom="true"
-                    android:paddingRight="4dp"
-                    android:gravity="right"
-                    android:text="暂无"
-                    android:textColor="@color/main_color"
-                    android:textSize="@dimen/nurse_config_value_font"/>
-            </RelativeLayout>
-
-            <RelativeLayout
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/nurse_config_item_height"
-                android:layout_marginTop="20dp">
-                <View
-                    android:id="@+id/nurse_config_item_color5"
-                    android:layout_width="10dp"
-                    android:layout_height="match_parent"
-                    android:background="@color/nursing_default_color"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_name5"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color5"
-                    android:paddingLeft="4dp"
-                    android:text="暂无"
-                    android:textColor="@color/text_name_color"
-                    android:textSize="@dimen/nurse_config_title_font"/>
-                <TextView
-                    android:id="@+id/nurse_config_item_value5"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_toRightOf="@id/nurse_config_item_color5"
-                    android:layout_alignParentBottom="true"
-                    android:paddingRight="4dp"
-                    android:gravity="right"
-                    android:text="暂无"
-                    android:textColor="@color/main_color"
-                    android:textSize="@dimen/nurse_config_value_font"/>
-            </RelativeLayout>
-
-        </LinearLayout>
-
-        <!--入住信息-->
-        <LinearLayout
-            android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="1"
-            android:layout_marginTop="10dp"
-            android:baselineAligned="false"
-            android:orientation="vertical"
-            android:gravity="center_horizontal">
-
-            <TextView
-                android:id="@+id/bed_customer_name"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:drawableTop="@mipmap/ic_custom_male"
-                android:gravity="center"
-                android:text="王老五"
-                android:textColor="@color/black"
-                android:textSize="22sp"/>
-
-            <TextView
-                android:id="@+id/bed_customer_age"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="10dp"
-                android:drawableLeft="@mipmap/ic_gender_male"
-                android:drawablePadding="4dp"
-                android:text="55岁"
-                android:textSize="18sp"/>
-
             <ImageView
                 android:id="@+id/bed_doctor_icon"
                 android:layout_width="48dp"
                 android:layout_height="48dp"
-                android:layout_marginTop="20dp"
-                android:src="@mipmap/ic_doctor_default"/>
+                android:src="@mipmap/ic_doctor_default"
+                android:visibility="gone"/>
 
             <TextView
                 android:id="@+id/bed_doctor_title"
@@ -230,7 +76,7 @@
                 android:layout_marginTop="10dp"
                 android:text="责任医生"
                 android:textColor="@color/text_name_color"
-                android:textSize="14sp"/>
+                android:textSize="24sp" />
 
             <TextView
                 android:id="@+id/bed_doctor_name"
@@ -238,14 +84,21 @@
                 android:layout_height="wrap_content"
                 android:text="暂无"
                 android:textColor="@color/black"
-                android:textSize="14sp"/>
+                android:textSize="28sp" />
+        </LinearLayout>
 
+        <LinearLayout
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:orientation="vertical">
             <ImageView
                 android:id="@+id/bed_nurse_icon"
                 android:layout_width="48dp"
                 android:layout_height="48dp"
-                android:layout_marginTop="10dp"
-                android:src="@mipmap/ic_nurse_default"/>
+                android:src="@mipmap/ic_nurse_default"
+                android:visibility="gone"/>
 
             <TextView
                 android:id="@+id/bed_nurse_title"
@@ -254,7 +107,7 @@
                 android:layout_marginTop="10dp"
                 android:text="责任护士"
                 android:textColor="@color/text_name_color"
-                android:textSize="14sp"/>
+                android:textSize="24sp" />
 
             <TextView
                 android:id="@+id/bed_nurse_name"
@@ -262,8 +115,7 @@
                 android:layout_height="wrap_content"
                 android:text="暂无"
                 android:textColor="@color/black"
-                android:textSize="14sp"/>
-
+                android:textSize="28sp" />
         </LinearLayout>
 
     </LinearLayout>

+ 2 - 0
callingdoor/src/main/res/values/colors.xml

@@ -95,4 +95,6 @@
     <color name="right_item_select">#B1DAF3</color>
 
     <color name="nursing_color">#FFA5A5</color>
+
+    <color name="bed_light_color">#44f29200</color>
 </resources>

+ 6 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/common/Constant.java

@@ -127,6 +127,10 @@ public class Constant {
     //护理门灯颜色
     public static String nursingColor = "010";
 
+    //当前是否有紧急呼叫
+    public static boolean sosOn = false;
+    public static int callNums = 0;
+
     //来电设备id
     public static Integer fromId = -1;
 
@@ -188,4 +192,6 @@ public class Constant {
     public static final int EVENT_REMOVE_CALL_FRAGMENT = 0x09;
 
     public static final int EVENT_RESTART_APP = 0x10;
+
+    public static final int EVENT_CLEAR_CALLS = 0x11;
 }

+ 60 - 0
middleware/src/main/code/com/wdkl/ncs/android/middleware/model/vo/FrameBedRelativeVO.java

@@ -0,0 +1,60 @@
+package com.wdkl.ncs.android.middleware.model.vo;
+
+/**
+ * @author
+ * @title: Vothin
+ * @projectName nc
+ * @date 2022/4/2810:44
+ */
+public class FrameBedRelativeVO {
+
+    private Integer relativeMemberId;
+
+    private String relativeMemberName;
+
+    private String relativeName;
+
+    private Integer relativeSex;
+
+    private Long relativeBirthday;
+
+    public Integer getRelativeMemberId() {
+        return relativeMemberId;
+    }
+
+    public void setRelativeMemberId(Integer relativeMemberId) {
+        this.relativeMemberId = relativeMemberId;
+    }
+
+    public String getRelativeMemberName() {
+        return relativeMemberName;
+    }
+
+    public void setRelativeMemberName(String relativeMemberName) {
+        this.relativeMemberName = relativeMemberName;
+    }
+
+    public String getRelativeName() {
+        return relativeName;
+    }
+
+    public void setRelativeName(String relativeName) {
+        this.relativeName = relativeName;
+    }
+
+    public Integer getRelativeSex() {
+        return relativeSex;
+    }
+
+    public void setRelativeSex(Integer relativeSex) {
+        this.relativeSex = relativeSex;
+    }
+
+    public Long getRelativeBirthday() {
+        return relativeBirthday;
+    }
+
+    public void setRelativeBirthday(Long relativeBirthday) {
+        this.relativeBirthday = relativeBirthday;
+    }
+}

+ 60 - 38
middleware/src/main/code/com/wdkl/ncs/android/middleware/model/vo/FrameBedVO.java

@@ -12,7 +12,7 @@ import java.util.List;
  * @create: 2021/03/03 12:01
  */
 
-public class FrameBedVO{
+public class FrameBedVO {
 
     private FrameDO frameBed;
     private Integer deviceCount;
@@ -22,9 +22,14 @@ public class FrameBedVO{
     private Integer customerSex;
     private Integer customerAge;
     private String customerAgeUnit;
+    private Long customerInDate;
+    private Long customerOutDate;
+    private String customerIllnessDesc;
     private String deviceSipId;
     private Integer bedDeviceId;
+    private String bedDeviceMac;
     private String bedDevicePhoneNumber;
+    private Integer bedDeviceType;
 
     private Integer doctorId;
     private String doctorName;
@@ -32,18 +37,11 @@ public class FrameBedVO{
     private String nurseName;
     private Integer workerId;
     private String workerName;
+    private String cardNo;
 
     private List<NurseConfigDto> nurseConfigDtos;
 
-
-    private Integer relativeMemberId;
-
-    private String relativeMemberName;
-
-    private String relativeName;
-
-    private Integer relativeSex;
-
+    private List<FrameBedRelativeVO> frameBedRelativeVos;
 
     public FrameDO getFrameBed() {
         return frameBed;
@@ -109,6 +107,30 @@ public class FrameBedVO{
         this.customerAgeUnit = customerAgeUnit;
     }
 
+    public Long getCustomerInDate() {
+        return customerInDate;
+    }
+
+    public void setCustomerInDate(Long customerInDate) {
+        this.customerInDate = customerInDate;
+    }
+
+    public Long getCustomerOutDate() {
+        return customerOutDate;
+    }
+
+    public void setCustomerOutDate(Long customerOutDate) {
+        this.customerOutDate = customerOutDate;
+    }
+
+    public String getCustomerIllnessDesc() {
+        return customerIllnessDesc;
+    }
+
+    public void setCustomerIllnessDesc(String customerIllnessDesc) {
+        this.customerIllnessDesc = customerIllnessDesc;
+    }
+
     public String getDeviceSipId() {
         return deviceSipId;
     }
@@ -125,6 +147,14 @@ public class FrameBedVO{
         this.bedDeviceId = bedDeviceId;
     }
 
+    public String getBedDeviceMac() {
+        return bedDeviceMac;
+    }
+
+    public void setBedDeviceMac(String bedDeviceMac) {
+        this.bedDeviceMac = bedDeviceMac;
+    }
+
     public String getBedDevicePhoneNumber() {
         return bedDevicePhoneNumber;
     }
@@ -133,6 +163,14 @@ public class FrameBedVO{
         this.bedDevicePhoneNumber = bedDevicePhoneNumber;
     }
 
+    public Integer getBedDeviceType() {
+        return bedDeviceType;
+    }
+
+    public void setBedDeviceType(Integer bedDeviceType) {
+        this.bedDeviceType = bedDeviceType;
+    }
+
     public Integer getDoctorId() {
         return doctorId;
     }
@@ -181,43 +219,27 @@ public class FrameBedVO{
         this.workerName = workerName;
     }
 
-    public List<NurseConfigDto> getNurseConfigDtos() {
-        return nurseConfigDtos;
-    }
-
-    public void setNurseConfigDtos(List<NurseConfigDto> nurseConfigDtos) {
-        this.nurseConfigDtos = nurseConfigDtos;
-    }
-
-    public Integer getRelativeMemberId() {
-        return relativeMemberId;
-    }
-
-    public void setRelativeMemberId(Integer relativeMemberId) {
-        this.relativeMemberId = relativeMemberId;
-    }
-
-    public String getRelativeMemberName() {
-        return relativeMemberName;
+    public String getCardNo() {
+        return cardNo;
     }
 
-    public void setRelativeMemberName(String relativeMemberName) {
-        this.relativeMemberName = relativeMemberName;
+    public void setCardNo(String cardNo) {
+        this.cardNo = cardNo;
     }
 
-    public String getRelativeName() {
-        return relativeName;
+    public List<NurseConfigDto> getNurseConfigDtos() {
+        return nurseConfigDtos;
     }
 
-    public void setRelativeName(String relativeName) {
-        this.relativeName = relativeName;
+    public void setNurseConfigDtos(List<NurseConfigDto> nurseConfigDtos) {
+        this.nurseConfigDtos = nurseConfigDtos;
     }
 
-    public Integer getRelativeSex() {
-        return relativeSex;
+    public List<FrameBedRelativeVO> getFrameBedRelativeVos() {
+        return frameBedRelativeVos;
     }
 
-    public void setRelativeSex(Integer relativeSex) {
-        this.relativeSex = relativeSex;
+    public void setFrameBedRelativeVos(List<FrameBedRelativeVO> frameBedRelativeVos) {
+        this.frameBedRelativeVos = frameBedRelativeVos;
     }
 }

+ 193 - 54
middleware/src/main/code/com/wdkl/ncs/android/middleware/tcp/enums/TcpAction.java

@@ -14,9 +14,11 @@ public interface TcpAction {
     String getDescription();
 
     enum CallbackAction implements TcpAction {
+        ACK("反馈"),
         SUCCESS("同步"),
-        FAILED("失败");
-        private String description;
+        FAILED("失败"),
+        NO_MATCH("没有匹配");
+        private final String description;
         CallbackAction(String description){
             this.description = description;
         }
@@ -36,7 +38,7 @@ public interface TcpAction {
         }
         public static CallbackAction fromString(String v) {
             CallbackAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? SUCCESS :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
@@ -47,10 +49,11 @@ public interface TcpAction {
         CALLING("通话中"),
         HANDOFF("挂断"),
         DATA("数据传输"),
-        CANCEL("取消");
+        CANCEL("取消"),
+        NO_MATCH("没有匹配");
 
 
-        private String description;
+        private final String description;
         PhoneAction(String description){
             this.description = description;
         }
@@ -71,7 +74,7 @@ public interface TcpAction {
         }
         public static PhoneAction fromString(String v) {
             PhoneAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? CALL :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
@@ -86,7 +89,7 @@ public interface TcpAction {
         HANDOFF("挂断"),
         CANCEL("取消"),
         PCALLING("已经通话中"),
-        VOICE_OFF("通话被接听"),
+        VOICE_OFF("通话被其他设备处理"),
         RS485CALL("485界面发起呼叫"),
         RS485CANCEL("485界面呼叫取消"),
         RS485CANCEL_BY_DOOR("485门口机取消房间内的呼叫"),
@@ -99,10 +102,14 @@ public interface TcpAction {
         GAIN_CALL("应答"),
         GAIN_OK("应答成功"),
         GAIN_FAIL("应答失败"),
-        GAINED("呼叫被应答");
+        GAINED("呼叫被应答"),
+        HCALL("手柄呼叫"),
+        HRESPONSE("响应手柄"),
+        HRESPONSED("响应过手柄了"),
+        NO_MATCH("没有匹配");
 
 
-        private String description;
+        private final String description;
         VoiceAction(String description){
             this.description = description;
         }
@@ -123,7 +130,7 @@ public interface TcpAction {
         }
         public static VoiceAction fromString(String v) {
             VoiceAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? CALL :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
@@ -139,9 +146,10 @@ public interface TcpAction {
         HANDOFF("挂断"),
         CANCEL("取消"),
         SUCCESS("呼叫成功"),
-        FAILED("呼叫失败");
+        FAILED("呼叫失败"),
+        NO_MATCH("没有匹配");
 
-        private String description;
+        private final String description;
         VideoAction(String description){
             this.description = description;
         }
@@ -162,14 +170,15 @@ public interface TcpAction {
         }
         public static VideoAction fromString(String v) {
             VideoAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? CALL :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
 
     enum SOSAction implements TcpAction {
-        CALL("紧急呼叫"),
-        CANCEL("取消"),
+        CALL("紧急呼叫"),   //1
+        CANCEL("取消"),   //1
+        CANCELED("已取消"),    //1
         TRANSFER("转接"),
         ALARM_TEST("测试报警"),
         ALARM_INTRUSION("侵入报警"),
@@ -180,13 +189,25 @@ public interface TcpAction {
         ALARM_DISASSEMBLE("防拆报警"),
         ALARM_FAULT("故障报警"),
         ALARM_DOOR_LOCK("门磁报警"),
+        ALARM_RESTRAINT_BAND("约束带报警"),
         ALARM_SMOKE("烟感报警"),
         ALARM_GAS("燃气报警"),
         ALARM_WATER_OVERFLOW("浸水报警"),
         ALARM_LOW_VOLTAGE("低电压报警"),
-        ALARM_TEMPERATURE("温度报警");
-
-        private String description;
+        ALARM_TEMPERATURE("温度报警"),
+        ALARM_FALL("跌到报警"),
+        ALARM_VITAL("体征报警"),
+        AlARM_BUTTON("紧急按钮"),
+        ALARM_FALL_RADAR("跌到报警"),
+        ALARM_INFUSION_RADAR("输液报警"),
+        ROOM_CALL("房间紧急呼叫"),    //1
+        OTHER_CALL("其他紧急呼叫"),   //1
+        RECEIVED("客户端收到确认"),
+        // 当设备在科室级时用这个PART_USER_CALL,比如:用户手环
+        PART_USER_CALL("用户紧急呼叫"),   //
+        NO_MATCH("没有匹配");
+
+        private final String description;
         SOSAction(String description){
             this.description = description;
         }
@@ -207,15 +228,16 @@ public interface TcpAction {
         }
         public static SOSAction fromString(String v) {
             SOSAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? CALL :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
     enum ReinforceAction implements TcpAction {
         CALL("增援"),
-        RESPONSED("已响应");
+        RESPONSED("已响应"),
+        NO_MATCH("没有匹配");
 
-        private String description;
+        private final String description;
         ReinforceAction(String description){
             this.description = description;
         }
@@ -236,7 +258,7 @@ public interface TcpAction {
         }
         public static ReinforceAction fromString(String v) {
             ReinforceAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? CALL :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
@@ -244,9 +266,10 @@ public interface TcpAction {
     enum IMAction implements TcpAction {
         MSG("语音留言"),
         MSG_READ("语音留言已读"),
-        RECEIVED("客户端收到确认");
+        RECEIVED("客户端收到确认"),
+        NO_MATCH("没有匹配");
 
-        private String description;
+        private final String description;
         IMAction(String description){
             this.description = description;
         }
@@ -267,7 +290,7 @@ public interface TcpAction {
         }
         public static IMAction fromString(String v) {
             IMAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? MSG_READ :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
 
     }
@@ -275,9 +298,10 @@ public interface TcpAction {
     enum CHANNELIMAction implements TcpAction {
         MSG("语音留言"),
         MSG_READ("语音留言已读"),
-        RECEIVED("接收端收到确认");
+        RECEIVED("接收端收到确认"),
+        NO_MATCH("没有匹配");
 
-        private String description;
+        private final String description;
         CHANNELIMAction(String description){
             this.description = description;
         }
@@ -298,21 +322,27 @@ public interface TcpAction {
         }
         public static CHANNELIMAction fromString(String v) {
             CHANNELIMAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? MSG_READ :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
 
     }
 
     enum DeviceAction implements TcpAction {
-        RESTART("重启"),
+        RESTART("重启APP"),
+        REBOOT("重启机器"),
+        OPEN_DEBUG("打开网络调试"),
         CONNECT("连接"),
         APP_UPDATE("APP更新"),
         DEVICE_REFRESH("设备刷新"),
         SYSTEM_SETTING("系统设置"),
         DEVICE_CHANGE("设备更换"),
-        USER_CHANGE("用户绑定");
+        USER_CHANGE("用户绑定"),
+        SERVER_CHANGE("设备ip地址更换"),
+        S485_POWER_RESET("485控制版复位电路"),
+        S485_POWER_RESET_SUCCESS("485控制版复位电路成功"),
+        NO_MATCH("没有匹配");
 
-        private String description;
+        private final String description;
         DeviceAction(String description){
             this.description = description;
         }
@@ -332,18 +362,21 @@ public interface TcpAction {
         }
         public static DeviceAction fromString(String v) {
             DeviceAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? RESTART :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
     enum EventAction implements TcpAction {
         KEY_CLICK("按键事件"),
-        RESPONSE("已响应"),
+        RESPONSE("响应"),
+        RESPONSED("已响应"),
         RECEIVED("接收端收到确认"),
         CANCEL("取消"),
         CANCEL_CONFIRM("接收端确认收到取消"),
-        COMPLETED("完成");
-        private String description;
+        NO_TARGET("没有目标设备"),
+        COMPLETED("完成"),
+        NO_MATCH("没有匹配");
+        private final String description;
         EventAction(String description){
             this.description = description;
         }
@@ -363,7 +396,7 @@ public interface TcpAction {
         }
         public static EventAction fromString(String v) {
             EventAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? KEY_CLICK :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
@@ -374,8 +407,12 @@ public interface TcpAction {
         SOS_CALL("紧急呼叫"),
         SOS_CANCEL("取消"),
         NURSING("护理"),
-        NURSING_END("护理结束");
-        private String description;
+        NURSING_END("护理结束"),
+        SHOW("显示"),
+        CLEAR("清除"),
+        NO_MATCH("没有匹配");
+
+        private final String description;
         SideAction(String description){
             this.description = description;
         }
@@ -395,7 +432,7 @@ public interface TcpAction {
         }
         public static SideAction fromString(String v) {
             SideAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? CALL :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
@@ -403,8 +440,10 @@ public interface TcpAction {
 
     enum DataAction implements TcpAction {
         REFRESH("刷新数据"),
-        INTERACTION("刷新交互列表");
-        private String description;
+        INTERACTION("刷新交互列表"),
+        NO_MATCH("没有匹配");
+
+        private final String description;
         DataAction(String description){
             this.description = description;
         }
@@ -424,14 +463,16 @@ public interface TcpAction {
         }
         public static DataAction fromString(String v) {
             DataAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? REFRESH :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
     enum BroadcastAction implements TcpAction {
         START("开始"),
-        STOP("停止");
-        private String description;
+        STOP("停止"),
+        NO_MATCH("没有匹配");
+
+        private final String description;
         BroadcastAction(String description){
             this.description = description;
         }
@@ -451,13 +492,15 @@ public interface TcpAction {
         }
         public static BroadcastAction fromString(String v) {
             BroadcastAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? START :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
     enum TimeAction implements TcpAction {
-        SYNC("同步");
-        private String description;
+        SYNC("同步"),
+        NO_MATCH("没有匹配");
+
+        private final String description;
         TimeAction(String description){
             this.description = description;
         }
@@ -477,7 +520,7 @@ public interface TcpAction {
         }
         public static TimeAction fromString(String v) {
             TimeAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? SYNC :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
@@ -492,10 +535,11 @@ public interface TcpAction {
         SUCCESS("连接主机成功"),
         HANGUP("挂断"),
         TIMEOUT("响应超时"),
-        FAILED("连接失败");
+        FAILED("连接失败"),
+        NO_MATCH("没有匹配");
 
 
-        private String description;
+        private final String description;
 
         EntraceGuardAction(String description) {
             this.description = description;
@@ -516,14 +560,16 @@ public interface TcpAction {
         }
         public static EntraceGuardAction fromString(String v) {
             EntraceGuardAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
         }
     }
 
     enum LocationAction implements TcpAction {
         ASK("主动询问"),
-        UPDATE("上传数据");
-        private String description;
+        UPDATE("上传数据"),
+        NO_MATCH("没有匹配");
+
+        private final String description;
         LocationAction(String description){
             this.description = description;
         }
@@ -543,7 +589,100 @@ public interface TcpAction {
         }
         public static LocationAction fromString(String v) {
             LocationAction userOptionEnum = ENUM_MAP.get(v);
-            return userOptionEnum == null ? ASK :userOptionEnum;
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
+        }
+    }
+
+    /**
+     * 433相关action
+      */
+    enum S433Action implements TcpAction {
+        CALL("呼叫"),
+        SOS_CALL("紧急呼叫"),
+        CANCEL("取消"),
+        SYNC_TIME("同步时间"),
+        DATA("同步数据"),
+        EXIST("调试"),
+        ACK("返回"),
+        NO_MATCH("没有匹配");
+
+        private final String description;
+        S433Action(String description){
+            this.description = description;
+        }
+        public String getDescription() {
+            return description;
+        }
+
+        public String getName(){
+            return this.name();
+        }
+
+        private final static Map<String , S433Action> ENUM_MAP = new HashMap<String, S433Action>();
+        static {
+            for(S433Action v : values()) {
+                ENUM_MAP.put(v.toString() , v);
+            }
+        }
+        public static S433Action fromString(String v) {
+            S433Action userOptionEnum = ENUM_MAP.get(v);
+            return userOptionEnum == null ? NO_MATCH :userOptionEnum;
+        }
+    }
+    enum SignInAction implements TcpAction{
+        SIGN_IN("发起签到"),
+        SIGN_IN_SUCCESS("签到成功"),
+        SIGN_IN_FAILED("签到失败");
+
+        private final String description;
+        SignInAction(String description){
+            this.description = description;
+        }
+        public String getDescription() {
+            return description;
+        }
+
+        public String getName(){
+            return this.name();
+        }
+
+        private final static Map<String , SignInAction> ENUM_MAP = new HashMap<String, SignInAction>();
+        static {
+            for(SignInAction v : values()) {
+                ENUM_MAP.put(v.toString() , v);
+            }
+        }
+        public static SignInAction fromString(String v) {
+            SignInAction signInAction = ENUM_MAP.get(v);
+            return signInAction;
+        }
+    }
+
+
+    enum PositionAction implements TcpAction{
+        POSITION_START("定位开始"),
+        POSITION_END("结束定位");
+        private final String description;
+        PositionAction(String description){
+            this.description = description;
+        }
+        public String getDescription() {
+            return description;
+        }
+
+        public String getName(){
+            return this.name();
+        }
+
+        private final static Map<String , PositionAction> ENUM_MAP = new HashMap<String, PositionAction>();
+        static {
+            for(PositionAction v : values()) {
+                ENUM_MAP.put(v.toString() , v);
+            }
+        }
+        public static PositionAction fromString(String v) {
+            PositionAction positionAction = ENUM_MAP.get(v);
+            return positionAction;
         }
     }
 }

+ 2 - 2
middleware/src/main/code/com/wdkl/ncs/android/middleware/utils/CommonUtils.java

@@ -15,8 +15,8 @@ public class CommonUtils {
     private static final String KEY_SP_SIP_PORT = "KEY_SP_SIP_PORT";
 
     //默认ip端口
-    //private static final String DEFAULT_URL = "8.129.220.143";
-    private static final String DEFAULT_URL = "172.28.100.100";
+    private static final String DEFAULT_URL = "8.129.220.143";
+    //private static final String DEFAULT_URL = "172.28.100.100";
     //private static final String DEFAULT_URL = "192.168.8.5";
     private static final String DEFAULT_URL_PORT = "8006";
     private static final String DEFAULT_SIP_PORT = "8188";