Переглянути джерело

1。所有模块增加断网重启
2.护士主机修复按键以及手柄无法响应的问题,
3。护士主机增加体征模块
4。分机增加a133灯的问题

xunchuanzhi 1 рік тому
батько
коміт
7dc6b62f48
31 змінених файлів з 1919 додано та 113 видалено
  1. 38 0
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivationActivity.kt
  2. 37 39
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt
  3. 4 2
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/HardTools.java
  4. 63 17
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/imp/A133HardTools.java
  5. 3 1
      android_bed/src/main/java/com/wdkl/app/ncs/callingbed/helper/AppUpdateHelper.java
  6. 2 0
      android_host/build.gradle
  7. 38 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/CallingHostActivationActivity.kt
  8. 8 3
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/HostbedinfoActivity.kt
  9. 88 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/adapter/SignDataAdapter.kt
  10. 81 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/adapter/SignMianAdapter.kt
  11. 3 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/di/NurseHomeComponent.kt
  12. 196 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/fragment/BedSingFragment.kt
  13. 170 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/fragment/SignDataTableFragment.kt
  14. 264 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/fragment/SignGraphOfCurveFragment.kt
  15. 4 6
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/hardware/imp/Z3128HardTools.java
  16. 19 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/settingconfig/SettingConfig.java
  17. 3 1
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java
  18. 395 0
      android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/util/LineChartUtils.java
  19. 1 4
      android_host/src/main/res/layout/activity_frame_bed_info.xml
  20. 82 0
      android_host/src/main/res/layout/activity_sign.xml
  21. 103 0
      android_host/src/main/res/layout/sign_data_table_fragment_lay.xml
  22. 121 0
      android_host/src/main/res/layout/sign_graph_curve_fragment_lay.xml
  23. 23 0
      android_host/src/main/res/layout/sign_main_item_lay.xml
  24. 61 0
      android_host/src/main/res/layout/sign_view_item_lay.xml
  25. BIN
      android_host/src/main/res/mipmap-mdpi/img_x.png
  26. 1 1
      bedlib/src/main/java/serialporttest/utils/SerialPortUtil.java
  27. 38 0
      callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivationActivity.kt
  28. 41 27
      callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivity.kt
  29. 30 10
      callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/helper/AppUpdateHelper.java
  30. 1 1
      callingdoor/src/main/res/layout/callingdoor_main_new.xml
  31. 1 1
      middleware/src/main/code/com/wdkl/ncs/android/middleware/utils/AppUtil.java

+ 38 - 0
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivationActivity.kt

@@ -308,6 +308,7 @@ class CallingbedActivationActivity  : BaseActivity<CallingbedActivationPresenter
         } else {
             Log.d(TAG, "server info null")
             showMsgMain("get server null")
+            checkNet()
         }
     }
 
@@ -325,6 +326,43 @@ class CallingbedActivationActivity  : BaseActivity<CallingbedActivationPresenter
             showMessage(msg)
         }
     }
+    //网络异常计数
+    private var netErrCount : Int = 0
+    private fun checkNet() {
+        /*
+        * 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
+        * 仅对3128设备有效
+         */
+        if (Build.MODEL.equals("rk3128") || BuildConfig.flag == Constant.DEV_W_A133) {
+            Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP))
+            var count = SettingConfig.getNetErrResetCount(this)
+            if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
+                netErrCount++
+            } else {
+                netErrCount = 0
+                if (count > 0) {
+                    count = 0
+                    SettingConfig.setNetErrResetCount(this, count)
+                }
+            }
+
+            if (netErrCount >= 5) {
+                //如果重启次数超过8次还是无网则不再重启
+                if (count < 8) {
+                    count++
+                    SettingConfig.setNetErrResetCount(this, count)
+                    handler.postDelayed({
+                        Log.e("reboot", "重启")
+                        AppUpdateHelper.reboot(this)
+                    }, 5000)
+                } else {
+                    runOnUiThread {
+                        WarningDialogHelper.showDialog(this)
+                    }
+                }
+            }
+        }
+    }
     override fun attachBaseContext(base: Context) {
         val languageId: Int = SettingConfig.getLanguageId(base)
         LocaleMangerUtils.setApplicationLanguageByIndex(base, languageId)

+ 37 - 39
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt

@@ -7,7 +7,6 @@ import android.content.pm.PackageManager
 import android.graphics.Color
 import android.media.AudioManager
 import android.net.ConnectivityManager
-import android.net.Uri
 import android.nfc.NfcAdapter
 import android.nfc.Tag
 import android.os.*
@@ -49,12 +48,9 @@ import com.wdkl.app.ncs.callingdoor.fragment.NurseFragment
 import com.wdkl.app.ncs.callingdoor.fragment.YhFragment
 import com.wdkl.ncs.android.lib.base.BaseActivity
 import com.wdkl.ncs.android.lib.base.BaseApplication
-import com.wdkl.ncs.android.lib.netdetection.ui.NetDetectActivity
 import com.wdkl.ncs.android.lib.utils.*
 import com.wdkl.ncs.android.lib.utils.TimeHandle.convertTimeToMilliseconds
 import com.wdkl.ncs.android.lib.vo.filter
-import com.wdkl.ncs.android.lib.widget.MenuDialog
-import com.wdkl.ncs.android.middleware.api.ApiManager
 import com.wdkl.ncs.android.middleware.api.UrlManager
 import com.wdkl.ncs.android.middleware.common.Constant
 import com.wdkl.ncs.android.middleware.common.MessageEvent
@@ -74,7 +70,6 @@ import com.wdkl.ncs.android.middleware.tcp.channel.ImUtil
 import com.wdkl.ncs.android.middleware.tcp.channel.OtherUtil
 import com.wdkl.ncs.android.middleware.tcp.channel.VideoUtil
 import com.wdkl.ncs.android.middleware.tcp.channel.VoiceUtil
-import com.wdkl.ncs.android.middleware.tcp.dto.TcpCallback
 import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
 import com.wdkl.ncs.android.middleware.tcp.enums.TcpAction
 import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
@@ -212,8 +207,6 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
     override fun init() {
         instance = this
         //Utils.hideStatusBar(activity, false)
-        //打开串口设备
-//        SerialPortUtil.getInstance().openSerialPortDCH()
         mNfcAdapter= NfcUtils.getInstance().nfcAdapter
         NfcUtils.getInstance().setReadNdefListener(this)
         Constant.NursingTitle =""
@@ -742,7 +735,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                 if (!TextUtils.isEmpty(Constant.SIP_ID)) {
                     //没有摄像头则只能拨打语音
                     if (Constant.supportCamera) {
-                        CallTypeDialogHelper.showDialog(activity, object : CallTypeDialogHelper.ClickListener{
+                        CallTypeDialogHelper.showDialog(activity, object : CallTypeDialogHelper.ClickListener {
                             override fun onVoiceClick() {
                                 startCall(Constant.VOICE_CALL)
                             }
@@ -806,7 +799,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
     }
 
     //设置串口监听
-    private fun setSerialListener() {
+    public fun setSerialListener() {
         SerialPortUtil.getInstance().setOnDataReceiveListener(this)
         SerialPortUtil.getInstance().setOnDataReceiveStringListener(this)
 
@@ -1622,6 +1615,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                             Util.wakeUpAndUnlock()
                             checkAppVersion()
                         } else if (tcpModel.action == TcpAction.DeviceAction.RESTART) {
+                            //后台做了重发此消息的机制.防止网络不好的时候没收到app重启,设备信息不刷新
+                            if(!TextUtils.isEmpty(tcpModel.tid)) {
+                                TcpClient.getInstance().sendMsg(tcpModel.toJson())
+                            }
                             Util.wakeUpAndUnlock()
                             //收到重启app指令,若当前处于正常待机状态则直接重启app,否则等待通话结束再重启
                             if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
@@ -1697,14 +1694,15 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                             }
                         }
                     } else if (tcpModel.action == TcpAction.DataAction.INTERACTION
-                        || tcpModel.action == TcpAction.EventAction.RESPONSE
-                        || tcpModel.action == TcpAction.CallbackAction.SUCCESS
+                            || tcpModel.action == TcpAction.EventAction.RESPONSE
+                            || tcpModel.action == TcpAction.CallbackAction.SUCCESS
 
                     ) {
                         if (tcpModel.action == TcpAction.EventAction.RESPONSE && tcpModel.type.equals(TcpType.EVENT)) { //事件响应,语音播报已响应
                             val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                             if (!responsed.contains(interactionVO.id)) { //已响应过的事件不在播报
-                                val speakStr = (interactionVO.actionEndMemberName ?: "") + "已响应" + interactionVO.data + "//请稍候"
+                                val speakStr = (interactionVO.actionEndMemberName
+                                        ?: "") + "已响应" + interactionVO.data + "//请稍候"
                                 SpeechUtil.getInstance().stopSpeak()
                                 SpeechUtil.getInstance().speak(speakStr)
                                 responsed.add(interactionVO.id)
@@ -1835,10 +1833,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
             }
 
             Constant.EVENT_END_CALL -> {
-               if(broadcastOn){
-                   broadcastOn = false
-                   stopBroadcast(true)
-               }
+                if (broadcastOn) {
+                    broadcastOn = false
+                    stopBroadcast(true)
+                }
 
             }
 
@@ -1850,7 +1848,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                     timer_1_name = messageEvent.time_name_1
                     main_time_tx_2.text = messageEvent.time_1
                     val milliseconds = convertTimeToMilliseconds(messageEvent.time_1)
-                    timer1_type= true
+                    timer1_type = true
                     timer1 = object : CountDownTimer(milliseconds, 1000) {
                         override fun onTick(millisUntilFinished: Long) {
                             val seconds = (millisUntilFinished / 1000) % 60
@@ -1863,9 +1861,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                         override fun onFinish() {
                             main_time_tx_2.text = "00:00:00"
                             data class MyObject(val title: String)
-                            val myObject = MyObject(timer_1_name+"倒计时已结束")
+
+                            val myObject = MyObject(timer_1_name + "倒计时已结束")
                             SOSHelper.sostime(myObject)
-                            timer1_type= false
+                            timer1_type = false
                             if (!timer1_type && !timer2_type && !timer3_type) {
                                 main_time_ll.visibility = View.GONE
                             }
@@ -1874,12 +1873,12 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
 //                        Log.d("Timer3", "Finished!")
                         }
                     }.start()
-                }else{
-                    if (timer1!=null){
+                } else {
+                    if (timer1 != null) {
                         timer1?.cancel()
                     }
                     main_time_tx_2.text = "00:00:00"
-                    timer1_type= false
+                    timer1_type = false
                     if (!timer1_type && !timer2_type && !timer3_type) {
                         main_time_ll.visibility = View.GONE
                     }
@@ -1890,7 +1889,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                     timer_2_name = messageEvent.time_name_2
                     main_time_tx_4.text = messageEvent.time_2
                     val milliseconds = convertTimeToMilliseconds(messageEvent.time_2)
-                    timer2_type= true
+                    timer2_type = true
                     timer2 = object : CountDownTimer(milliseconds, 1000) {
                         override fun onTick(millisUntilFinished: Long) {
                             val seconds = (millisUntilFinished / 1000) % 60
@@ -1904,9 +1903,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                         override fun onFinish() {
                             main_time_tx_4.text = "00:00:00"
                             data class MyObject(val title: String)
-                            val myObject = MyObject(timer_2_name+"倒计时已结束")
+
+                            val myObject = MyObject(timer_2_name + "倒计时已结束")
                             SOSHelper.sostime(myObject)
-                            timer2_type= false
+                            timer2_type = false
                             if (!timer1_type && !timer2_type && !timer3_type) {
                                 main_time_ll.visibility = View.GONE
                             }
@@ -1914,12 +1914,12 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
 //                        Log.d("Timer3", "Finished!")
                         }
                     }.start()
-                }else{
-                    if (timer2!=null){
+                } else {
+                    if (timer2 != null) {
                         timer2?.cancel()
                     }
                     main_time_tx_4.text = "00:00:00"
-                    timer2_type= false
+                    timer2_type = false
                     if (!timer1_type && !timer2_type && !timer3_type) {
                         main_time_ll.visibility = View.GONE
                     }
@@ -1930,7 +1930,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                     timer_3_name = messageEvent.time_name_3
                     main_time_tx_6.text = messageEvent.time_3
                     val milliseconds = convertTimeToMilliseconds(messageEvent.time_3)
-                    timer3_type= true
+                    timer3_type = true
                     timer3 = object : CountDownTimer(milliseconds, 1000) {
                         override fun onTick(millisUntilFinished: Long) {
                             val seconds = (millisUntilFinished / 1000) % 60
@@ -1944,9 +1944,10 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                         override fun onFinish() {
                             main_time_tx_6.text = "00:00:00"
                             data class MyObject(val title: String)
-                            val myObject = MyObject(timer_3_name+"倒计时已结束")
+
+                            val myObject = MyObject(timer_3_name + "倒计时已结束")
                             SOSHelper.sostime(myObject)
-                            timer3_type= false
+                            timer3_type = false
                             if (!timer1_type && !timer2_type && !timer3_type) {
                                 main_time_ll.visibility = View.GONE
                             }
@@ -1954,12 +1955,12 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
 //                        Log.d("Timer3", "Finished!")
                         }
                     }.start()
-                }else{
-                    if (timer3!=null){
+                } else {
+                    if (timer3 != null) {
                         timer3?.cancel()
                     }
                     main_time_tx_6.text = "00:00:00"
-                    timer3_type= false
+                    timer3_type = false
                     if (!timer1_type && !timer2_type && !timer3_type) {
                         main_time_ll.visibility = View.GONE
                     }
@@ -2032,10 +2033,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
         }
         playing = true
 
-        if (SettingConfig.getSipEnabled(activity)) {
-
-
-        }else{
+        if (!SettingConfig.getSipEnabled(activity)) {
             //初始化 engine
             WebRTCEngine.getInstance().init(true, this)
             //初始化 janusClient
@@ -2095,7 +2093,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
         * 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
         * 仅对3128设备有效
          */
-        if (Build.MODEL.equals("rk3128")) {
+        if (Build.MODEL.equals("rk3128") || BuildConfig.flag == Constant.DEV_W_A133) {
             Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP))
             var count = SettingConfig.getNetErrResetCount(this)
             if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {

+ 4 - 2
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/HardTools.java

@@ -40,6 +40,8 @@ public  class HardTools {
     //安装方式2
     public void startInstallApk(AppUpdateActivity context ){}
 
+    public void CallConfigg(int mic,int yl){}
+
 
     //提供卡号
     public  void offerCardData(String data){}
@@ -47,11 +49,11 @@ public  class HardTools {
     public void offerKeyBoardData(String data){}
     //是否开启灯光
     public  void enableLed(boolean isEnable){}
+
     public  void enableIRLed(boolean isEnable){}
+
     public  void enableControlLed(boolean isEnable,int id){}
     //麦克风
-    //
-
     public void enalbeNet(boolean isEnable){}
     //设置voip 初始化配置
     public void setVoipConfig(){}

+ 63 - 17
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/hardware/imp/A133HardTools.java

@@ -8,8 +8,11 @@ import android.content.pm.PackageManager;
 import android.os.Build;
 import android.util.Log;
 
+import com.wdkl.app.ncs.callingbed.activity.CallingbedActivity;
 import com.wdkl.app.ncs.callingbed.hardware.HardTools;
 import com.wdkl.app.ncs.callingbed.helper.AppUpdateHelper;
+import com.wdkl.app.ncs.callingbed.helper.SOSHelper;
+import com.wdkl.app.ncs.callingbed.helper.SerialPortHelper;
 import com.wdkl.ncs.android.lib.base.BaseApplication;
 import com.wdkl.ncs.android.lib.utils.AppTool;
 import com.wdkl.ncs.android.middleware.common.Constant;
@@ -44,14 +47,53 @@ public class A133HardTools extends HardTools {
 
     @Override
     public void unInit() {
+        SerialPortUtil.getInstance().closeSerialPort();
+    }
 
+    @Override
+    public void setSOSStart() {
+        SOSHelper.sosStart();
     }
 
     @Override
+    public void setSOSStop() {
+        SOSHelper.sosStop();
+    }
+    @Override
+    public void setDoorLight(int type) {
+        if (type==1){
+            //绿色
+            SerialPortHelper.setDoorLight(1, "001");
+        }else if (type==2){
+            //白色
+            SerialPortHelper.setDoorLight(1, "111"); //白色
+        }else if (type==3){
+            //红色
+            SerialPortHelper.setDoorLight(1, "200"); //红色闪烁
+        }else if (type==4){
+            //红色
+            SerialPortHelper.setDoorLight(0, "000"); //关闭
+        }
+    }
+    @Override
     public void resetDevice() {
-
+        ZhylManager.getInstance(BaseApplication.appContext).sys_setReboot();
     }
 
+    @Override
+    public void setSerial(CallingbedActivity callingbedActivity) {
+//        try {
+//            Thread.sleep(1500); // 延时1500毫秒 (1.5秒)
+//            // 串口监听
+//            callingbedActivity.setSerialListener();
+//            // 打开MICsetSerialListener
+//            SerialPortHelper.setMIC(false);
+//            SerialPortHelper.setHandsFree(true);
+//            SerialPortHelper.setSosLight("0");
+//        } catch (InterruptedException e) {
+//            e.printStackTrace();
+//        }
+    }
 
     @Override
     public void resetDevicex(Application application) {
@@ -102,22 +144,7 @@ public class A133HardTools extends HardTools {
     }
 
 
-    @Override
-    public void setDoorLight(int type) {
-//        if (type==1){
-//            //绿色
-//            SerialPortHelper.setDoorLight(1, Constant.nursingColor);
-//        }else if (type==2){
-//            //白色
-//            SerialPortHelper.setDoorLight(1, "111"); //白色
-//        }else if (type==3){
-//            //红色
-//            SerialPortHelper.setDoorLight(1, "200"); //红色闪烁
-//        }else if (type==4){
-//            //红色
-//            SerialPortHelper.setDoorLight(0, "000"); //关闭
-//        }
-    }
+
 
     private boolean checkAppExist(Context context, String name) {
         PackageManager packageManager = context.getPackageManager();
@@ -132,4 +159,23 @@ public class A133HardTools extends HardTools {
         Log.e("wdkl_app", "callingdoor app exist: " + appExist);
         return appExist;
     }
+
+    @Override
+    public void CallConfigg(int mic, int yl) {
+        try {
+            int mic1 =  ZhylManager.getInstance(BaseApplication.appContext).sys_getMic1gain(BaseApplication.appContext);
+            int yl2 = ZhylManager.getInstance(BaseApplication.appContext).sys_getDacVolume(BaseApplication.appContext);
+            if (  mic1 ==0 ||  yl2==0 ){
+                //喇叭功放设置
+                ZhylManager.getInstance(BaseApplication.appContext).sys_setDacVolume(BaseApplication.appContext,yl);
+                ZhylManager.getInstance(BaseApplication.appContext).sys_setMic1gain(BaseApplication.appContext,mic);
+            }else{
+                ZhylManager.getInstance(BaseApplication.appContext).sys_setDacVolume(BaseApplication.appContext,yl2);
+                ZhylManager.getInstance(BaseApplication.appContext).sys_setMic1gain(BaseApplication.appContext,mic1);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }

+ 3 - 1
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/helper/AppUpdateHelper.java

@@ -13,7 +13,9 @@ import android.os.Environment;
 
 import android.util.Log;
 
+import com.wdkl.app.ncs.callingbed.BuildConfig;
 import com.wdkl.ncs.android.component.welcome.activity.WelcomeActivity;
+import com.wdkl.ncs.android.middleware.common.Constant;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -227,7 +229,7 @@ public class AppUpdateHelper {
 
     public static void reboot(Context context) {
         Log.e("reboot","重启");
-        if (Build.MODEL.equals("rk3128")) {
+        if (Build.MODEL.equals("rk3128")  || BuildConfig.flag.equals(Constant.DEV_W_A133)) {
             try {
                 SerialPortHelper.resetDevice();
                 Intent intent = new Intent(Intent.ACTION_REBOOT);

+ 2 - 0
android_host/build.gradle

@@ -121,6 +121,8 @@ dependencies {
 
     compile 'com.contrarywind:Android-PickerView:4.1.9'
 
+    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
+
 
 
 }

+ 38 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/CallingHostActivationActivity.kt

@@ -292,6 +292,7 @@ class CallingHostActivationActivity  : BaseActivity<DevicePresenter, Callinghost
         } else {
             Log.d(TAG, "server info null")
             showMsgMain("get server null")
+            checkNet()
         }
     }
 
@@ -300,6 +301,43 @@ class CallingHostActivationActivity  : BaseActivity<DevicePresenter, Callinghost
             showMessage(msg)
         }
     }
+     //网络异常计数
+     private var netErrCount : Int = 0
+     private fun checkNet() {
+         /*
+         * 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
+         * 仅对3128设备有效
+          */
+         if (Build.MODEL.equals("rk3128") || BuildConfig.flag == Constant.DEV_W_A133) {
+             Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP))
+             var count = SettingConfig.getNetErrResetCount(this)
+             if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
+                 netErrCount++
+             } else {
+                 netErrCount = 0
+                 if (count > 0) {
+                     count = 0
+                     SettingConfig.setNetErrResetCount(this, count)
+                 }
+             }
+
+             if (netErrCount >= 5) {
+                 //如果重启次数超过8次还是无网则不再重启
+                 if (count < 8) {
+                     count++
+                     SettingConfig.setNetErrResetCount(this, count)
+                     handler.postDelayed({
+                         Log.e("reboot", "重启")
+                         AppUpdateHelper.reboot(this)
+                     }, 5000)
+                 } else {
+                     runOnUiThread {
+                         WarningDialogHelper.showDialog(this,false)
+                     }
+                 }
+             }
+         }
+     }
     override fun attachBaseContext(base: Context) {
         val languageId: Int = SettingConfig.getLanguageId(base)
         LocaleMangerUtils.setApplicationLanguageByIndex(base, languageId)

+ 8 - 3
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/activity/HostbedinfoActivity.kt

@@ -116,7 +116,12 @@ class HostbedinfoActivity : BaseActivity<BedHospitalInfoActivityPresenter, Activ
         }
 
         bed_info_butoon_4.setOnClickListener {
-
+            val bundle = Bundle().apply {
+                putString("customerId", frame.customerId.toString())
+            }
+            val fragment = BedSingFragment()
+            fragment.arguments = bundle
+            showMiddleFragment(fragment)
         }
         bed_info_butoon_5.setOnClickListener {
             val bundle = Bundle().apply {
@@ -233,13 +238,13 @@ class HostbedinfoActivity : BaseActivity<BedHospitalInfoActivityPresenter, Activ
                 bed_info_butoon_3.setBackgroundResource(R.drawable.shape_main_hos_txt_bg)
                 bed_info_butoon_3.setTextColor(getResources().getColor(R.color.white));
             }
-            is BedsInTheWardFragment -> {
+            is BedSingFragment -> {
                 //体征
                 bed_info_butoon_4.setBackgroundResource(R.drawable.shape_main_hos_txt_bg)
                 bed_info_butoon_4.setTextColor(getResources().getColor(R.color.white));
             }
             is BedAdviceFragment -> {
-                //体征
+                //医嘱
                 bed_info_butoon_5.setBackgroundResource(R.drawable.shape_main_hos_txt_bg)
                 bed_info_butoon_5.setTextColor(getResources().getColor(R.color.white));
             }

+ 88 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/adapter/SignDataAdapter.kt

@@ -0,0 +1,88 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.LinearLayout
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.wdkl.ncs.android.component.nursehome.R
+
+import com.wdkl.ncs.android.lib.utils.TimeHandle
+import com.wdkl.ncs.android.middleware.model.vo.SingDataBean
+
+class SignDataAdapter : RecyclerView.Adapter<SignDataAdapter.ViewHolder>{
+
+    private var context: Context
+    private var data: ArrayList<SingDataBean.LogListBean>
+    private lateinit var onItemClickListener: OnItemClickListener
+    private var selectedPosition = 0
+
+    constructor(context: Context, data: ArrayList<SingDataBean.LogListBean>): super() {
+        this.context = context
+        this.data = data
+    }
+
+    fun setOnItemClickListener(listener: OnItemClickListener) {
+        this.onItemClickListener = listener
+    }
+
+    fun updateData(data: ArrayList<SingDataBean.LogListBean>) {
+        this.data = data
+        notifyDataSetChanged()
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+        val view = LayoutInflater.from(parent.context).inflate(R.layout.sign_view_item_lay, parent, false)
+        val viewHolder = ViewHolder(view)
+
+        return viewHolder
+    }
+
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+        if (position % 2 == 0) {
+            // 偶数设置黑色背景
+            holder.signviewlltop.setBackgroundResource(R.color.text_name_color);
+        } else {
+            // 奇数位置设置白色背景
+            holder.signviewlltop.setBackgroundResource(R.color.white);
+        }
+        var number = position+1
+        holder.signitemname.text =number.toString()
+        holder.signitemtype.text = data.get(position).param_name
+        holder.signitemmoney.text = data.get(position).vs_value.toString()
+        holder.signitemtime.text = TimeHandle.getDateTime( data.get(position).create_time  * 1000L, "yyyy-MM-dd HH:mm")
+
+    }
+
+    private fun updateSelectedPosition(newPosition: Int) {
+        selectedPosition = newPosition
+        notifyDataSetChanged()
+    }
+    class ViewHolder: RecyclerView.ViewHolder {
+        var signitemname : TextView
+        var signitemtype : TextView
+        var signitemmoney : TextView
+        var signitemtime : TextView
+        var signviewlltop : LinearLayout
+
+
+        constructor(itemView: View): super(itemView) {
+            signitemname = itemView.findViewById(R.id.sign_item_name)
+            signitemtype = itemView.findViewById(R.id.sign_item_type)
+            signitemmoney = itemView.findViewById(R.id.sign_item_money)
+            signitemtime = itemView.findViewById(R.id.sign_item_time)
+            signviewlltop = itemView.findViewById(R.id.sign_view_ll_top)
+
+        }
+    }
+
+    interface OnItemClickListener {
+        fun onItemClick(view: View, keyId: Int)
+    }
+}

+ 81 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/adapter/SignMianAdapter.kt

@@ -0,0 +1,81 @@
+package com.wdkl.ncs.android.component.nursehome.adapter
+
+import android.content.Context
+import android.graphics.Color
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.middleware.model.vo.SingDataBean
+
+class SignMianAdapter : RecyclerView.Adapter<SignMianAdapter.ViewHolder>{
+
+    private var context: Context
+    private var data: ArrayList<SingDataBean>
+    private lateinit var onItemClickListener: OnItemClickListener
+    private var selectedPosition = 0
+
+    constructor(context: Context, data: ArrayList<SingDataBean>): super() {
+        this.context = context
+        this.data = data
+    }
+
+    fun setOnItemClickListener(listener: OnItemClickListener) {
+        this.onItemClickListener = listener
+    }
+
+    fun updateData(data: ArrayList<SingDataBean>) {
+        this.data = data
+        notifyDataSetChanged()
+    }
+
+    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
+        val view = LayoutInflater.from(parent.context).inflate(R.layout.sign_main_item_lay, parent, false)
+        val viewHolder = ViewHolder(view)
+
+        return viewHolder
+    }
+
+    override fun getItemCount(): Int {
+        return data.size
+    }
+
+    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
+        if ( data.get(position).vital_signs_name!=null){
+            holder.signitemname.text = data.get(position).vital_signs_name
+        }
+        // 设置item的背景颜色
+        if (position == selectedPosition) {
+            holder.signitemname.setBackgroundResource(R.drawable.shape_main_hos_txt_bg);// 设置选中状态的背景颜色
+            holder.signitemname.setTextColor(Color.parseColor("#FFFFFF"));// 设置选中状态的字体颜色
+        } else {
+            holder.signitemname.setBackground(null); // 设置选中状态的背景颜色
+            holder.signitemname.setTextColor(Color.parseColor("#737373"));// 设置默认状态的字体颜色
+
+        }
+        holder.signitemname.setOnClickListener {
+            onItemClickListener.onItemClick(holder.signitemname, position)
+            updateSelectedPosition(position);
+        }
+    }
+
+    private fun updateSelectedPosition(newPosition: Int) {
+        selectedPosition = newPosition
+        notifyDataSetChanged()
+    }
+    class ViewHolder: RecyclerView.ViewHolder {
+        var signitemname : TextView
+
+
+        constructor(itemView: View): super(itemView) {
+            signitemname = itemView.findViewById(R.id.sign_main_item_name)
+
+        }
+    }
+
+    interface OnItemClickListener {
+        fun onItemClick(view: View, keyId: Int)
+    }
+}

+ 3 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/di/NurseHomeComponent.kt

@@ -43,5 +43,8 @@ interface NurseHomeComponent{
     fun inject(activity: BroadcastListFragment)
     fun inject(activity: BroadcasthhFragment)
     fun inject(activity: BroadcastSetFragment)
+    fun inject(activity: BedSingFragment)
+    fun inject(activity: SignDataTableFragment)
+    fun inject(activity: SignGraphOfCurveFragment)
 
 }

+ 196 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/fragment/BedSingFragment.kt

@@ -0,0 +1,196 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+
+
+import android.os.Bundle
+import android.view.View
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentManager
+import androidx.fragment.app.FragmentTransaction
+import androidx.recyclerview.widget.LinearLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.CostItemAdapter2
+import com.wdkl.ncs.android.component.nursehome.adapter.SignMianAdapter
+import com.wdkl.ncs.android.component.nursehome.databinding.ActivitySignBinding
+import com.wdkl.ncs.android.component.nursehome.databinding.CostViewLayBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.lib.vo.filter
+import com.wdkl.ncs.android.middleware.common.Constant
+import com.wdkl.ncs.android.middleware.common.MessageEvent
+import com.wdkl.ncs.android.middleware.logic.contract.callingbed.BedCostFragmentContract
+import com.wdkl.ncs.android.middleware.logic.contract.callingbed.BedSignFragmentContract
+import com.wdkl.ncs.android.middleware.logic.presenter.callingbed.BedCostFragmentPresenter
+import com.wdkl.ncs.android.middleware.logic.presenter.callingbed.BedSignFragmentPresenter
+import com.wdkl.ncs.android.middleware.model.vo.CustomerFeeConfig
+import com.wdkl.ncs.android.middleware.model.vo.CustomerFeeConfigByGroupNameVO
+import com.wdkl.ncs.android.middleware.model.vo.SingDataBean
+import kotlinx.android.synthetic.main.activity_sign.*
+import kotlinx.android.synthetic.main.cost_view_lay.*
+import kotlinx.android.synthetic.main.view_title_layout.*
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 基础信息--体征界面
+ */
+class BedSingFragment : BaseFragment<BedSignFragmentPresenter, ActivitySignBinding>(), BedSignFragmentContract.View, SignMianAdapter.OnItemClickListener {
+
+    private val TAG = "SignActivity"
+    private lateinit var adapter: SignMianAdapter
+    private var infoFragment: Fragment? = null
+    var type:Int=-1
+    private var customerId : String="-1"
+
+    override fun getLayId(): Int {
+        return R.layout.activity_sign
+    }
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+    //数据绑定
+    override fun init() {
+        customerId = arguments?.getString("customerId").toString()
+
+        adapter = SignMianAdapter(activity, ArrayList())
+        val layoutManager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
+        rv_sign_main_view.layoutManager = layoutManager
+        adapter.setOnItemClickListener(this)
+        rv_sign_main_view.adapter = adapter
+        if (customerId != null&& customerId != "-1") {
+            presenter.loadSignsByPage(customerId.toInt())
+        } else {
+            showMessage("no member id")
+        }
+        //默认显示曲线图
+        val fragment = SignGraphOfCurveFragment()
+        var bundle = Bundle()
+        bundle.putInt("state", type)
+        fragment.arguments = bundle
+        addCallFragment(fragment)
+    }
+
+    private fun addCallFragment(fragment: Fragment) {
+        requireActivity().supportFragmentManager.beginTransaction().apply {
+            infoFragment?.let {
+                remove(it)
+            }
+            infoFragment = fragment
+            updateLeftBtState()
+            add(R.id.activity_sign, fragment)
+            commit()
+        }
+    }
+    private fun updateLeftBtState() {
+        sign_previous_button.setBackgroundResource(R.drawable.shape_main_bt_bg)
+        sign_previous_button.setTextColor(getResources().getColor(R.color.text_name_color))
+
+        sign_next_button.setBackgroundResource(R.drawable.shape_main_bt_bg)
+        sign_next_button.setTextColor(getResources().getColor(R.color.text_name_color))
+
+        // 判断当前显示的Fragment是哪个
+        when (infoFragment) {
+            is SignDataTableFragment -> {
+                //数据列表
+                sign_next_button.setBackgroundResource(R.drawable.shape_main_hos_txt_bg)
+                sign_next_button.setTextColor(getResources().getColor(R.color.white))
+            }
+            is SignGraphOfCurveFragment -> {
+                //体征
+                sign_previous_button.setBackgroundResource(R.drawable.shape_main_hos_txt_bg)
+                sign_previous_button.setTextColor(getResources().getColor(R.color.white))
+
+            }
+
+
+        }
+
+    }
+    override fun bindEvent() {
+        //曲线图
+        sign_previous_button.setOnClickListener {
+            val fragment = SignGraphOfCurveFragment()
+            var bundle = Bundle()
+            bundle.putInt("state", type)
+            bundle.putString("customerId", customerId)
+            fragment.arguments = bundle
+            addCallFragment(fragment)
+
+        }
+
+
+        //数据列表
+        sign_next_button.setOnClickListener {
+            val fragment = SignDataTableFragment()
+            var bundle = Bundle()
+            bundle.putInt("state", type)
+            bundle.putString("customerId", customerId)
+            fragment.arguments = bundle
+            addCallFragment(fragment)
+        }
+
+    }
+
+
+    override fun onStart() {
+        EventBus.getDefault().register(this)
+        super.onStart()
+    }
+
+    override fun onStop() {
+        EventBus.getDefault().unregister(this)
+        super.onStop()
+    }
+    override fun destory() {
+    }
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        if (Constant.EVENT_FINISHh == messageEvent.type) {
+
+        }else if (Constant.EVENT_SING_TYPE == messageEvent.type) {
+            type = messageEvent.message.hashCode()
+
+        }
+
+
+    }
+
+    override fun showsigns(advices: ArrayList<SingDataBean>) {
+        if(advices !=null){
+            adapter.updateData(advices)
+        }
+
+
+    }
+
+    override fun onNoNet() {
+
+    }
+
+
+    override fun onError(message: String, type: Int) {
+
+    }
+
+    override fun complete(message: String, type: Int) {
+
+    }
+
+    override fun start() {
+
+    }
+
+    override fun networkMonitor(state: NetState) {
+
+    }
+
+    override fun onItemClick(view: View, keyId: Int) {
+        type=keyId
+        EventBus.getDefault().post(MessageEvent(keyId, Constant.EVENT_SING_TYPE))
+    }
+
+
+}

+ 170 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/fragment/SignDataTableFragment.kt

@@ -0,0 +1,170 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+
+import android.view.View
+import androidx.recyclerview.widget.LinearLayoutManager
+import com.enation.javashop.net.engine.model.NetState
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.adapter.SignDataAdapter
+
+import com.wdkl.ncs.android.component.nursehome.databinding.SignDataTableFragmentLayBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.lib.vo.filter
+import com.wdkl.ncs.android.middleware.common.Constant
+import com.wdkl.ncs.android.middleware.common.MessageEvent
+import com.wdkl.ncs.android.middleware.logic.contract.callingbed.BedSignFragmentContract
+import com.wdkl.ncs.android.middleware.logic.presenter.callingbed.BedSignFragmentPresenter
+import com.wdkl.ncs.android.middleware.model.vo.CustomerFeeConfigVO
+import com.wdkl.ncs.android.middleware.model.vo.DeviceMenulist
+import com.wdkl.ncs.android.middleware.model.vo.SingDataBean
+import kotlinx.android.synthetic.main.cost_view_lay.*
+import kotlinx.android.synthetic.main.cost_view_lay.rv_cost_main_view
+import kotlinx.android.synthetic.main.sign_data_table_fragment_lay.*
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+/**
+ * 体征数据表格
+ * */
+class SignDataTableFragment : BaseFragment<BedSignFragmentPresenter, SignDataTableFragmentLayBinding>(), BedSignFragmentContract.View {
+
+
+    private val TAG = "SignDataTableFragment"
+    private lateinit var adapter: SignDataAdapter
+    private var allOrders = ArrayList<SingDataBean>()
+
+    var type:Int=0
+    var state :Int=0
+    private var customerId : String="-1"
+    override fun getLayId(): Int {
+        return R.layout.sign_data_table_fragment_lay
+    }
+
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    override fun init() {
+        customerId = arguments?.getString("customerId").toString()
+        state = requireArguments().getInt("state")
+        adapter = SignDataAdapter(activity, ArrayList())
+        val layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
+        rv_sing_data_item_view.layoutManager = layoutManager
+        rv_sing_data_item_view.adapter = adapter
+
+        if (customerId != null&& customerId != "-1") {
+            presenter.loadSignsByPage(55375)
+//            presenter.loadSignsByPage(Constant.CUSTOM_ID)
+        } else {
+            showMessage("no custom id")
+        }
+    }
+
+    override fun bindEvent() {
+        //
+    }
+
+    override fun destory() {
+        //
+    }
+
+    override fun onStart() {
+        EventBus.getDefault().register(this)
+        super.onStart()
+    }
+
+    override fun onStop() {
+        EventBus.getDefault().unregister(this)
+        super.onStop()
+    }
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        if (Constant.EVENT_SING_TYPE == messageEvent.type) {
+            type = messageEvent.message.hashCode()
+            if (allOrders != null) {
+                rv_sing_data_item_tx.text = allOrders.get(type).vital_signs_name+"数据列表"
+                if (allOrders.get(type).log_list!=null) {
+                    adapter.updateData(allOrders.get(type).log_list as ArrayList<SingDataBean.LogListBean>)
+                    emptyImageView.visibility= View.GONE
+                } else {
+                    adapter.updateData(ArrayList()) // 更新空的数据列表来刷新界面为空白
+                    emptyImageView.visibility= View.VISIBLE
+                }
+            }
+        }
+    }
+
+
+
+
+
+    override fun onError(message: String, type: Int) {
+        showMessage(message)
+    }
+
+    override fun showsigns(advices: ArrayList<SingDataBean>) {
+        if (advices!=null){
+                allOrders.clear()
+                allOrders=advices
+            if (state!=-1){
+                type =state
+                rv_sing_data_item_tx.text = allOrders.get(type).vital_signs_name+"数据列表"
+                if (allOrders.get(type).log_list!=null) {
+                    adapter.updateData(allOrders.get(type).log_list as ArrayList<SingDataBean.LogListBean>)
+                    emptyImageView.visibility= View.GONE
+                } else {
+                    adapter.updateData(ArrayList()) // 更新空的数据列表来刷新界面为空白
+                    emptyImageView.visibility= View.VISIBLE
+                }
+                return
+            }
+                if (allOrders.get(type).log_list !=null) {
+                    adapter.updateData(allOrders.get(type).log_list as ArrayList<SingDataBean.LogListBean>)
+                    emptyImageView.visibility= View.GONE
+                } else {
+                    adapter.updateData(ArrayList()) // 更新空的数据列表来刷新界面为空白
+                    emptyImageView.visibility= View.VISIBLE
+                }
+        }else{
+            showMessage("数据为空")
+        }
+
+    }
+
+    override fun onNoNet() {
+        showMessage("none network")
+    }
+
+    override fun complete(message: String, type: Int) {
+    }
+
+    override fun start() {
+    }
+//    override fun onDestroy() {
+//        if (allOrders!=null){
+//            allOrders.clear()
+//        }
+//        super.onDestroy()
+//    }
+//
+//    override fun onPause() {
+//        if (allOrders!=null){
+//            allOrders.clear()
+//        }
+//
+//        super.onPause()
+//    }
+    override fun networkMonitor(state: NetState) {
+        state.filter(onWifi = {
+
+        },onMobile = {
+
+        },offline = {
+
+        })
+    }
+}

+ 264 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/fragment/SignGraphOfCurveFragment.kt

@@ -0,0 +1,264 @@
+package com.wdkl.ncs.android.component.nursehome.fragment
+
+import android.util.Log
+import android.view.View
+import com.enation.javashop.net.engine.model.NetState
+import com.github.mikephil.charting.data.Entry
+
+import com.wdkl.ncs.android.component.nursehome.R
+import com.wdkl.ncs.android.component.nursehome.databinding.SignGraphCurveFragmentLayBinding
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
+import com.wdkl.ncs.android.component.nursehome.util.LineChartUtils
+import com.wdkl.ncs.android.lib.base.BaseFragment
+import com.wdkl.ncs.android.lib.utils.TimeHandle
+import com.wdkl.ncs.android.lib.utils.showMessage
+import com.wdkl.ncs.android.lib.vo.filter
+import com.wdkl.ncs.android.middleware.common.Constant
+import com.wdkl.ncs.android.middleware.common.MessageEvent
+import com.wdkl.ncs.android.middleware.logic.contract.callingbed.BedSignFragmentContract
+import com.wdkl.ncs.android.middleware.logic.presenter.callingbed.BedSignFragmentPresenter
+import com.wdkl.ncs.android.middleware.model.vo.SingDataBean
+import kotlinx.android.synthetic.main.sign_graph_curve_fragment_lay.*
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+
+
+class SignGraphOfCurveFragment : BaseFragment<BedSignFragmentPresenter, SignGraphCurveFragmentLayBinding>(), BedSignFragmentContract.View {
+
+
+    private val TAG = "SignGraphOfCurveFragment"
+    private var allOrders = ArrayList<SingDataBean>()
+    var type:Int=0
+    var state :Int=0
+
+    private val xdata = ArrayList<String>()
+
+
+    private val list = ArrayList<Entry>() //数据集合
+
+    private val list1 =ArrayList<Entry>() //数据集合
+
+
+    private var lineChartUtils: LineChartUtils? = null
+
+    private var customerId : String="-1"
+
+
+    override fun getLayId(): Int {
+        return R.layout.sign_graph_curve_fragment_lay
+    }
+
+    override fun bindDagger() {
+        NurseHomeLaunch.component.inject(this)
+    }
+
+    override fun init() {
+        customerId = arguments?.getString("customerId").toString()
+        state = requireArguments().getInt("state")
+        if (state!=-1){
+            type =state
+        }
+        if (customerId != null&& customerId != "-1") {
+            presenter.loadSignsByPage(55375)
+//            presenter.loadSignsByPage(Constant.CUSTOM_ID)
+        } else {
+            showMessage("no custom id")
+        }
+    }
+
+    private fun initView() {
+        if (allOrders!=null){
+            if (allOrders.get(0).log_list!=null){
+                for (i in 0 until allOrders.get(0).log_list.size) {
+                    list.add(Entry(i.toFloat(), (allOrders.get(0).log_list[i].vs_value).toFloat()))
+                    xdata.add(TimeHandle.getDateTime(allOrders.get(type).log_list[i].create_time * 1000L, "yyyy-MM-dd HH:mm"))
+                }
+            }
+
+        }
+//        //直接调用即可
+         lineChartUtils = LineChartUtils(
+                 list,
+                 list1,
+                 xdata,
+                 1,
+                 chart)
+    }
+
+    //设置顶部线条颜色
+    private fun setlinview(type: Int) {
+        sign_graph_curve_text_top.text = allOrders.get(type).vital_signs_name+"数据列表"
+        sign_graph_d.text = "单位:"+allOrders.get(type).unit
+        if (type==1){
+            sign_graph_curve_text1_top.text = "收缩压"
+            sign_graph_curve_text2_top.text = "舒张压"
+            sign_graph_curve_text2_top.visibility =View.VISIBLE
+            sign_graph_curve_view_2_top.visibility =View.VISIBLE
+        }else{
+            sign_graph_curve_text1_top.text =  allOrders.get(type).vital_signs_name
+            sign_graph_curve_text2_top.visibility =View.GONE
+            sign_graph_curve_view_2_top.visibility =View.GONE
+        }
+
+    }
+
+    //设置顶部线条颜色
+    private fun setlindata() {
+        list.clear()
+        list1.clear()
+        xdata.clear()
+        setlinview(type)
+        if (allOrders != null) {
+            if (allOrders.get(type).log_list!=null) {
+                sign_graph_emptyImageView.visibility= View.GONE
+                if (allOrders.get(type).vital_signs_name.equals("血压")){
+
+                    if (lineChartUtils==null){
+                        for (i in 0 until allOrders.get(type).log_list.size) {
+                            if (allOrders.get(type).log_list[i].param_id==16){
+                                list?.add(Entry(i.toFloat(), (allOrders.get(type).log_list[i].vs_value).toFloat()))
+                            }else{
+                                list1?.add(Entry(i.toFloat(), (allOrders.get(type).log_list[i].vs_value).toFloat()))
+                            }
+                            xdata.add(TimeHandle.getDateTime(allOrders.get(type).log_list[i].create_time * 1000L, "yyyy-MM-dd HH:mm"))
+                        }
+                        lineChartUtils = LineChartUtils(
+                                list,
+                                list1,
+                                xdata,
+                                2,
+                                chart)
+                    }else{
+                        lineChartUtils!!.createLineChartUtils();
+                        for (i in 0 until allOrders.get(type).log_list.size) {
+                            if (allOrders.get(type).log_list[i].param_id==16){
+                                list?.add(Entry(i.toFloat(), (allOrders.get(type).log_list[i].vs_value).toFloat()))
+                            }else{
+                                list1?.add(Entry(i.toFloat(), (allOrders.get(type).log_list[i].vs_value).toFloat()))
+                            }
+                            xdata.add(TimeHandle.getDateTime(allOrders.get(type).log_list[i].create_time * 1000L, "yyyy-MM-dd HH:mm"))
+                        }
+                        lineChartUtils!!.updateData(list,list1  ,xdata,type+1,chart)
+                    }
+                }else{
+                    if (lineChartUtils==null){
+                        for (i in 0 until allOrders.get(type).log_list.size) {
+                            list.add(Entry(i.toFloat(), (allOrders.get(type).log_list[i].vs_value).toFloat()))
+                            xdata.add(TimeHandle.getDateTime(allOrders.get(type).log_list[i].create_time * 1000L, "yyyy-MM-dd HH:mm"))
+                        }
+                        lineChartUtils = LineChartUtils(
+                                list,
+                                list1,
+                                xdata,
+                                type+1,
+                                chart)
+                    }else{
+                        lineChartUtils!!.createLineChartUtils();
+                        for (i in 0 until allOrders.get(type).log_list.size) {
+                            list.add(Entry(i.toFloat(), (allOrders.get(type).log_list[i].vs_value).toFloat()))
+                            xdata.add(TimeHandle.getDateTime(allOrders.get(type).log_list[i].create_time * 1000L, "yyyy-MM-dd HH:mm"))
+                        }
+                        Log.d("LineChartUtils", "xdata size: " + xdata.size);
+                        lineChartUtils!!.updateData(list,null  ,xdata,type+1,chart)
+                    }
+                }
+
+            } else {
+                lineChartUtils!!.createLineChartUtils();
+                sign_graph_emptyImageView.visibility= View.VISIBLE
+            }
+        }
+
+    }
+
+
+    override fun bindEvent() {
+        //
+    }
+
+    override fun destory() {
+        //
+    }
+
+    override fun onStart() {
+        EventBus.getDefault().register(this)
+        super.onStart()
+    }
+
+    override fun onStop() {
+        EventBus.getDefault().unregister(this)
+        super.onStop()
+    }
+
+
+
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMoonEvent(messageEvent: MessageEvent) {
+        if (Constant.EVENT_SING_TYPE == messageEvent.type) {
+            type = messageEvent.message.hashCode()
+            setlindata()
+        }
+    }
+
+
+
+
+
+    override fun onError(message: String, type: Int) {
+        showMessage(message)
+    }
+
+    override fun showsigns(advices: ArrayList<SingDataBean>) {
+        if (advices!=null){
+            allOrders.clear()
+            allOrders=advices
+            if (allOrders.get(type).log_list !=null) {
+                sign_graph_emptyImageView.visibility= View.GONE
+                setlindata()
+            } else {
+                sign_graph_emptyImageView.visibility= View.VISIBLE
+            }
+        }else{
+            showMessage("数据为空")
+        }
+
+    }
+
+    override fun onNoNet() {
+        showMessage("none network")
+    }
+
+    override fun complete(message: String, type: Int) {
+    }
+
+    override fun start() {
+    }
+
+//    override fun onDestroy() {
+//        if (allOrders!=null){
+//            allOrders.clear()
+//        }
+//        lineChartUtils!!.createLineChartUtils();
+//        super.onDestroy()
+//    }
+//
+//    override fun onPause() {
+//        if (allOrders!=null){
+//            allOrders.clear()
+//        }
+//        lineChartUtils!!.createLineChartUtils();
+//
+//        super.onPause()
+//    }
+
+    override fun networkMonitor(state: NetState) {
+        state.filter(onWifi = {
+
+        }, onMobile = {
+
+        }, offline = {
+
+        })
+    }
+}

+ 4 - 6
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/hardware/imp/Z3128HardTools.java

@@ -47,17 +47,16 @@ public class Z3128HardTools extends HardTools {
 
     @Override
     public void init() {
-        SerialPortUtil.getInstance().openSerialPort();
+        SerialPortUtilHost.getInstance().openSerialPort();
         //开启串口心跳 //区分大朝华和
-
-        SerialPortUtil.getInstance().startHeartBeat();
+        SerialPortUtilHost.getInstance().startHeartBeat();
 
     }
 
     @Override
     public void unInit() {
-        SerialPortUtil.getInstance().closeHeart();
-        SerialPortUtil.getInstance().closeSerialPort();
+        SerialPortUtilHost.getInstance().closeHeart();
+        SerialPortUtilHost.getInstance().closeSerialPort();
     }
 
     @Override
@@ -93,7 +92,6 @@ public class Z3128HardTools extends HardTools {
 
     @Override
     public void setSerial(NurseHomeActivity activity) {
-
             //串口监听
         activity.setSerialListener();
         SerialPortUtilHost.getInstance().powerIndicator(1);

+ 19 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/settingconfig/SettingConfig.java

@@ -130,6 +130,9 @@ public class SettingConfig {
     //app上次启动时间
     private static final String KEY_SP_APP_START_TIME = "KEY_SP_APP_START_TIME";
 
+    //网络异常重启次数
+    private static final String KEY_SP_NET_ERR_RESET_COUNT = "KEY_SP_NET_ERR_RESET_COUNT";
+
     //呼叫转移开关
     private static final String KEY_SP_CALL_TRANSFER = "KEY_SP_CALL_TRANSFER";
     private static final String KEY_SP_SOS_NAME = "KEY_SP_SOS_NAME";
@@ -842,7 +845,23 @@ public class SettingConfig {
         return getSP(context).getString(KEY_SP_APP_START_TIME, "Unknow");
     }
 
+    /**
+     * 获取网络异常重启次数
+     *
+     * @return
+     */
+    public static int getNetErrResetCount(Context context) {
+        return getSP(context).getInt(KEY_SP_NET_ERR_RESET_COUNT, 0);
+    }
 
+    /**
+     * 设置网络异常重启次数
+     *
+     * @param value
+     */
+    public static void setNetErrResetCount(Context context, int value) {
+        getEditor(context).putInt(KEY_SP_NET_ERR_RESET_COUNT, value).apply();
+    }
 
 
     private static SharedPreferences getSP(Context context) {

+ 3 - 1
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/util/AppUpdateHelper.java

@@ -13,9 +13,11 @@ import android.os.Environment;
 
 import android.util.Log;
 
+import com.wdkl.ncs.android.component.nursehome.BuildConfig;
 import com.wdkl.ncs.android.component.nursehome.activity.CallingHostActivationActivity;
 import com.wdkl.ncs.android.component.nursehome.service.WdklSipService;
 import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig;
+import com.wdkl.ncs.android.middleware.common.Constant;
 
 
 import java.io.BufferedReader;
@@ -213,7 +215,7 @@ public class AppUpdateHelper {
     }
 
     public static void reboot(Context context) {
-        if (Build.MODEL.equals("rk3128")) {
+        if (Build.MODEL.equals("rk3128")|| BuildConfig.flag.equals(Constant.DEV_W_A133)) {
             try {
                 Intent intent = new Intent(Intent.ACTION_REBOOT);
                 intent.putExtra("nowait", 1);

+ 395 - 0
android_host/src/main/java/com/wdkl/ncs/android/component/nursehome/util/LineChartUtils.java

@@ -0,0 +1,395 @@
+package com.wdkl.ncs.android.component.nursehome.util;
+
+import android.graphics.Color;
+import android.util.Log;
+
+import com.github.mikephil.charting.charts.LineChart;
+import com.github.mikephil.charting.components.AxisBase;
+import com.github.mikephil.charting.components.Description;
+import com.github.mikephil.charting.components.XAxis;
+import com.github.mikephil.charting.components.YAxis;
+import com.github.mikephil.charting.data.Entry;
+import com.github.mikephil.charting.data.LineData;
+import com.github.mikephil.charting.data.LineDataSet;
+import com.github.mikephil.charting.formatter.IAxisValueFormatter;
+import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
+
+
+import java.util.ArrayList;
+
+public class LineChartUtils {
+
+     //血糖
+     String[] xuetang ={"0","4","8","12","16","20"};
+    //血压
+    String[] xueya ={"40","64","88","112","136","160"};
+    //血氧
+    String[] xueyang ={"90","92","94","96","98","100"};
+    //脉搏
+    String[] mangbo ={"40","56","72","88","104","120"};
+    //体温
+    String[] tiwen ={"32","34","35","38","40","42"};
+    //hrv
+    String[] hrv ={"0","24","48","72","96","120"};
+    //xinlv
+    String[] xinlv ={"40","56","72","88","104","120"};
+    //黄亘
+    String[] xingen ={"0","4","8","12","16","20"};
+    //胎心
+    String[] taixin ={"40","56","72","88","104","120"};
+
+
+
+    private ArrayList<String> xdata = new ArrayList<>();
+    private String[] ydata={};
+
+    private ArrayList<Entry> list1 = new ArrayList<>();  //数据集合
+    private ArrayList<Entry> list2 = new ArrayList<>();  //数据集合
+
+    private  ArrayList<ILineDataSet> dataSets=new ArrayList<>();
+
+
+
+    LineChart lineChart;
+    private LineDataSet set;
+    private LineDataSet set1;
+    private LineDataSet set2;
+
+    public LineChartUtils(ArrayList<Entry> list_1, ArrayList<Entry> list_2 ,ArrayList<String>  xdata,int type,LineChart lineChart) {
+        this.list1=list_1;
+        this.list2=list_2;
+        this.xdata=xdata;
+        this.lineChart=lineChart;
+        setYdata(type);
+        setData(list1,list2);
+    }
+    private void setData(ArrayList<Entry> list1,ArrayList<Entry> list2) {
+        XwangGe();
+        if (list1!=null&& list1.size()>0){
+            set = new LineDataSet(list1, "");
+            setLine(set);
+            this.dataSets.add(set);
+        }
+        if (list2!=null && list2.size()>0){
+            set1 = new LineDataSet(list2, "");
+            setLine2(set1);
+            this.dataSets.add(set1);
+        }
+        //创建一个数据集
+        LineData data = new LineData(dataSets);
+        //设置数据
+        lineChart.setData(data);
+        lineChart.invalidate();
+//        lineChart.notifyDataSetChanged();
+
+        //隐藏图表右下角显示内容
+        Description description = new Description();
+        description.setEnabled(false);
+        lineChart.setDescription(description);
+    }
+
+    public void updateData(ArrayList<Entry> newList1, ArrayList<Entry> newList2 ,ArrayList<String>  x_data,int type,LineChart lineChart) {
+         Log.d("LineChartUtils", "xdata size: " + xdata.size());
+        Log.d("LineChartUtils", "x_data size: " + x_data.size());
+        this.list1=newList1;
+        this.list2=newList2;
+        this.xdata=x_data;
+        this.lineChart=lineChart;
+        setYdata(type);
+        setData(list1,list2);
+
+//        this.list1.clear();
+//        this.list2.clear();
+//        this.dataSets.clear();
+//        this.xdata.clear();
+//
+//        if (x_data!=null){
+//            this.xdata.addAll(x_data);
+//        }
+//        if (newList1!=null){
+//            this.list1.addAll(newList1);
+//            set = new LineDataSet(list1, "");
+//            setLine(set);
+//            this.dataSets.add(set);
+//
+//        }
+//        if (newList2!=null){
+//            this.list2.addAll(newList2);
+//            set1 = new LineDataSet(list2, "");
+//            setLine2(set1);
+//            this.dataSets.add(set1);
+//
+//        }
+//        setYdata(type);
+//        XwangGe();
+//
+//        LineData lineData = lineChart.getData();
+//        lineData = new LineData(dataSets);
+//        lineChart.setData(lineData);
+//
+//
+////        lineChart.setData(lineData);  // 更新数据
+////        lineData.notifyDataChanged();
+//        lineChart.notifyDataSetChanged();
+//        lineChart.invalidate();  // 通知图表数据已经改变,需要重绘
+    }
+    public void createLineChartUtils() {
+        if (list1!=null){
+            this.list1.clear();
+        }
+
+        if (list2!=null){
+            this.list2.clear();
+        }
+        this.dataSets.clear();
+        this.xdata.clear();
+        lineChart.invalidate();
+        lineChart.clear();
+
+
+    }
+    private void setYdata(int type) {
+        switch (type) {
+            case 1:
+                this.ydata=xuetang;
+                break;
+            case 2:
+                this.ydata=xueya;
+                break;
+            case 3:
+                this.ydata=xueyang;
+                break;
+            case 4:
+                this.ydata=mangbo;
+                break;
+            case 5:
+                this.ydata=tiwen;
+                break;
+            case 6:
+                this.ydata=hrv;
+                break;
+            case 7:
+                this.ydata=xinlv;
+                break;
+            case 8:
+                this.ydata=xingen;
+                break;
+            case 9:
+                this.ydata=taixin;
+                break;
+            default:
+                // 在这里处理其他情况
+                break;
+        }
+    }
+    private void setLine(LineDataSet set) {
+
+        //设置线条的颜色
+        set.setColor(Color.parseColor("#D4716E"));
+        //虚线模式下绘制直线
+        //set.enableDashedLine(20f, 5f, 0f);
+        //点击后高亮线的显示颜色
+        //set.enableDashedHighlightLine(50f, 15f, 0f);
+
+        //设置数据小圆点的颜色
+        set.setCircleColor(Color.parseColor("#D4716E"));
+        //设置圆点是否有空心
+        set.setDrawCircles(true);
+        //设置线条的宽度,最大10f,最小0.2f
+        set.setLineWidth(2f);
+        //设置小圆点的半径,最小1f,默认4f
+        set.setCircleRadius(4f);
+        //设置是否显示小圆点
+        set.setDrawCircles(true);
+        //设置字体颜色
+        set.setValueTextColor(Color.parseColor("#D4716E"));
+        //设置折线为圆滑折线(加在上面的setLine方法里)
+        set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
+
+        //设置字体大小
+        set.setValueTextSize(10f);
+        set.setFillColor(Color.parseColor("#D4716E"));
+        //设置是否填充
+        set.setDrawFilled(false);
+
+
+    }
+    private void setLine2(LineDataSet set) {
+        //设置线条的颜色
+        set.setColor(Color.parseColor("#6D7C87"));
+        //虚线模式下绘制直线
+        //set.enableDashedLine(20f, 5f, 0f);
+        //点击后高亮线的显示颜色
+        //set.enableDashedHighlightLine(50f, 15f, 0f);
+        //设置折线为圆滑折线(加在上面的setLine方法里)
+        set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
+
+        //设置数据小圆点的颜色
+        set.setCircleColor(Color.parseColor("#6D7C87"));
+        //设置圆点是否有空心
+        set.setDrawCircles(true);
+        //设置线条的宽度,最大10f,最小0.2f
+        set.setLineWidth(2f);
+        //设置小圆点的半径,最小1f,默认4f
+        set.setCircleRadius(4f);
+        //设置是否显示小圆点
+        set.setDrawCircles(true);
+        //设置字体颜色
+        set.setValueTextColor(Color.parseColor("#6D7C87"));
+        //设置字体大小
+        set.setValueTextSize(10f);
+        //设置是否填充
+        set.setDrawFilled(false);
+
+    }
+    private void setLine3(LineDataSet set) {
+        //设置线条的颜色
+        set.setColor(Color.parseColor("#90BCC2"));
+        //虚线模式下绘制直线
+        //set.enableDashedLine(20f, 5f, 0f);
+        //点击后高亮线的显示颜色
+        //set.enableDashedHighlightLine(50f, 15f, 0f);
+        //设置折线为圆滑折线(加在上面的setLine方法里)
+        //set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
+
+        //设置数据小圆点的颜色
+        set.setCircleColor(Color.parseColor("#90BCC2"));
+        //设置圆点是否有空心
+        set.setDrawCircles(true);
+        //设置线条的宽度,最大10f,最小0.2f
+        set.setLineWidth(1f);
+        //设置小圆点的半径,最小1f,默认4f
+        set.setCircleRadius(2f);
+        //设置是否显示小圆点
+        set.setDrawCircles(true);
+        //设置字体颜色
+        set.setValueTextColor(Color.parseColor("#90BCC2"));
+        //设置字体大小
+        set.setValueTextSize(10f);
+        //设置是否填充
+        set.setDrawFilled(true);
+
+    }
+    private void XwangGe(){
+        //设置x轴网格线
+        XAxis xAxis=lineChart.getXAxis();
+        //以虚线模式画网格线
+        xAxis.enableGridDashedLine(0f,0f,0f);
+
+            IAxisValueFormatter formatter = new IAxisValueFormatter() {
+                @Override
+                public String getFormattedValue(float value, AxisBase axis) {
+                    // 在这里根据数值 value 返回对应的标签字符串
+                    // 这里简单起见,直接将 value 转为整数作为标签
+                    if (xdata!=null && xdata.size()>0) {
+                        int index = (int) value;
+                        if (index >= 0 && index < xdata.size()) {
+                            return xdata.get(index);
+                        }
+                    }
+                    return String.valueOf(value);
+                }
+            };
+
+            // 设置标签值的格式
+            xAxis.setValueFormatter(formatter);
+
+        // 创建一个实现了 IAxisValueFormatter 接口的自定义类
+
+        //设置x轴最大值
+//        xAxis.setAxisMaximum(200f);
+//        //设置x轴最小值
+//        xAxis.setAxisMinimum(0f);
+//
+//        //撤销设置的最大值,让轴自动计算
+//        xAxis.resetAxisMaximum();
+//        //撤销设置的最小值,让轴自动计算
+//        xAxis.resetAxisMinimum();
+        //设置x轴标签数,默认为6个
+        xAxis.setLabelCount(6);
+        //设置x轴标签数,若强制启用true,可能导致轴上的数字不均匀
+//        xAxis.setLabelCount(10,true);
+
+//        //设置x轴之间的最小间隔。用于在图表放大后标签不至于重合
+//        xAxis.setGranularity(1f);
+//        //设置x轴轴线的宽度
+//        xAxis.setAxisLineWidth(1f);
+        //设置轴线的颜色
+        xAxis.setAxisLineColor(Color.parseColor("#C3CAFA"));
+
+        //设置x轴显示位置在底部
+        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
+
+        //关闭边框矩形
+        lineChart.setDrawBorders(false);
+
+        lineChart.getLegend().setEnabled(false);
+
+        lineChart.getAxisLeft().setDrawAxisLine(false);
+
+        //不绘制y轴左边的线
+        lineChart.getAxisLeft().setDrawAxisLine(false);
+        //不绘制y轴右边的线
+        lineChart.getAxisRight().setDrawAxisLine(false);
+
+        //禁用图表右边y轴
+        lineChart.getAxisRight().setEnabled(false);
+//        //禁用x轴
+//        lineChart.getXAxis().setEnabled(false);
+        //隐藏图表左边y轴标签
+//        lineChart.getAxisLeft().setDrawLabels(false);
+        //关闭x轴网格线./即竖线
+        lineChart.getXAxis().setDrawGridLines(false);
+
+        // 获取第一个值
+        float firstFloatValue = Float.parseFloat(xuetang[0]);
+
+         // 获取最后一个值
+        float lastValue =  Float.parseFloat(ydata[ydata.length - 1]);
+
+        YAxis yAxi1=lineChart.getAxisLeft();
+        yAxi1.setLabelCount(5);
+        yAxi1.setDrawAxisLine(false);
+//        yAxi1.setAxisMinimum(0);
+        yAxi1.setAxisMaxValue(lastValue);
+        yAxi1.setAxisMinValue(firstFloatValue);
+//        yAxi1.setAxisLineWidth(0f);
+        yAxi1.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
+        yAxi1.setAxisMinValue(0f);
+
+//        yAxi1.setAxisLineColor(Color.parseColor("#00000000")); // 设置Y轴坐标轴
+//
+//
+//        YAxis yAx2=lineChart.getAxisRight();
+//        yAx2.setEnabled(false);
+
+//        // 创建一个实现了 IAxisValueFormatter 接口的自定义类
+//        IAxisValueFormatter formatter1= new IAxisValueFormatter() {
+//            @Override
+//            public String getFormattedValue(float value, AxisBase axis) {
+//                // 在这里根据数值 value 返回对应的标签字符串
+//                // 这里简单起见,直接将 value 转为整数作为标签
+//                int index = Math.round(value);
+//                if (index >= 0 && index < ydata.length) {
+//                    return ydata[index];
+//                } else {
+//                    // 处理索引越界或无效值的情况,返回一个默认值或者空字符串
+//                    return "N/A";
+//                }
+//            }
+//        };
+
+//        //设置y轴网格线
+//
+//        yAxi1.setValueFormatter(formatter1);
+
+
+
+
+
+
+
+
+    }
+
+}

+ 1 - 4
android_host/src/main/res/layout/activity_frame_bed_info.xml

@@ -27,7 +27,6 @@
                      android:layout_width="match_parent"
                      android:layout_height="@dimen/d110"
                      android:background="@drawable/shape_bed_bg"
-                     android:layout_marginTop="@dimen/d20"
                      >
 
                      <ImageView
@@ -147,8 +146,7 @@
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="horizontal"
-                         android:layout_marginTop="@dimen/d20"
-                         android:layout_marginLeft="@dimen/d16"
+
                          >
                          <TextView
                              android:id="@+id/bed_info_butoon_1"
@@ -226,7 +224,6 @@
                              android:singleLine="true"
                              android:ellipsize="end"
                              android:text="体征"
-                             android:visibility="gone"
                              android:textStyle="bold"
                              android:focusableInTouchMode="true"
                              android:textSize="20sp" />

+ 82 - 0
android_host/src/main/res/layout/activity_sign.xml

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout
+    xmlns:android="http://schemas.android.com/apk/res/android">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="200dp"
+        android:orientation="vertical"
+        android:background="#EAF2F9"
+        >
+
+
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d50"
+            android:orientation="horizontal"
+            >
+
+            <LinearLayout
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="0.8"
+                android:orientation="horizontal"
+                android:layout_gravity="center_vertical"
+                android:gravity="center_vertical"
+                android:background="@color/white"
+                >
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/rv_sign_main_view"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:gravity="center"
+                   />
+            </LinearLayout>
+
+
+
+            <LinearLayout
+                android:layout_width="240dp"
+                android:layout_height="42dp"
+                android:orientation="horizontal"
+                android:layout_marginLeft="@dimen/d10"
+                android:layout_marginRight="@dimen/d10"
+                android:layout_gravity="center_vertical"
+                android:gravity="center"
+                >
+                c<Button
+                    android:id="@+id/sign_previous_button"
+                    android:layout_width="@dimen/d92"
+                    android:layout_height="@dimen/d25"
+                    android:gravity="center"
+                    android:background="@drawable/shape_main_hos_txt_bg"
+                    android:text="曲线图"
+                    android:textSize="12sp"
+                    android:textColor="@color/white"/>
+                <Button
+                    android:id="@+id/sign_next_button"
+                    android:layout_width="@dimen/d92"
+                    android:layout_height="@dimen/d25"
+                    android:gravity="center"
+                    android:text="数据列表"
+                    android:background="@android:color/transparent"
+                    android:textSize="12sp"
+                    android:layout_marginLeft="@dimen/d10"
+                    android:textColor="@color/black"/>
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+        <FrameLayout
+            android:id="@+id/activity_sign"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+
+            android:layout_marginBottom="@dimen/d5"
+            android:background="@color/white"
+            />
+
+    </LinearLayout>
+
+</layout>

+ 103 - 0
android_host/src/main/res/layout/sign_data_table_fragment_lay.xml

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@drawable/shape_bed_bg"
+    android:padding="10dp">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_vertical"
+        android:background="@drawable/shape_bed_bg"
+        >
+        <ImageView
+            android:layout_width="20dp"
+            android:layout_height="20dp"
+            android:src="@mipmap/img_x"
+            />
+        <TextView
+            android:id="@+id/rv_sing_data_item_tx"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="血糖数据列表"
+            android:layout_marginLeft="@dimen/d20"
+            android:textSize="@dimen/font_size_12"
+            android:textColor="@color/black"
+            android:textStyle="bold"
+            />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_vertical"
+        android:background="@drawable/shape_bed_bg"
+        android:layout_marginTop="@dimen/d10"
+        >
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="序号"
+            android:textSize="@dimen/font_size_14"
+            android:textColor="@color/black"
+            android:textStyle="bold"
+            />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="参数"
+            android:textSize="@dimen/font_size_14"
+            android:gravity="center"
+            android:textColor="@color/black"
+            android:textStyle="bold"
+            />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="体征值"
+            android:textSize="@dimen/font_size_14"
+            android:gravity="center"
+            android:textColor="@color/black"
+            android:textStyle="bold"
+            />
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="测量时间"
+            android:textSize="@dimen/font_size_14"
+            android:gravity="center"
+            android:textColor="@color/black"
+            android:textStyle="bold"
+            />
+
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/emptyImageView"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:src="@mipmap/list"
+        android:layout_gravity="center"
+        android:visibility="gone"
+        />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/rv_sing_data_item_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="@dimen/d10"
+        android:layout_marginBottom="10dp"/>
+
+
+
+</LinearLayout>
+</layout>

+ 121 - 0
android_host/src/main/res/layout/sign_graph_curve_fragment_lay.xml

@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@drawable/shape_bed_bg"
+    android:padding="10dp">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@drawable/shape_bed_bg"
+        >
+        <ImageView
+            android:id="@+id/sign_graph_curve_img_top"
+            android:layout_width="20dp"
+            android:layout_height="20dp"
+            android:layout_alignParentLeft="true"
+            android:src="@mipmap/img_x"
+            />
+        <TextView
+            android:id="@+id/sign_graph_curve_text_top"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="血糖数据列表"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="@dimen/d20"
+            android:layout_toRightOf="@+id/sign_graph_curve_img_top"
+            android:textSize="@dimen/font_size_14"
+            android:textColor="@color/black"
+            android:textStyle="bold"
+            />
+
+       <LinearLayout
+           android:layout_width="wrap_content"
+           android:layout_height="wrap_content"
+           android:orientation="horizontal"
+           android:layout_alignParentRight="true"
+           android:layout_centerVertical="true"
+           android:gravity="center"
+           >
+
+           <TextView
+               android:id="@+id/sign_graph_curve_text1_top"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:text="血糖"
+               android:layout_centerVertical="true"
+               android:textSize="@dimen/font_size_12"
+               android:textColor="@color/text_black"
+               android:textStyle="bold"
+               />
+
+           <View
+               android:id="@+id/sign_graph_curve_view_1_top"
+               android:layout_width="@dimen/d25"
+               android:layout_height="@dimen/d2"
+               android:background="@color/main_color"
+               android:layout_marginLeft="@dimen/d10"
+               android:layout_marginRight="@dimen/d30"
+               android:layout_centerVertical="true"
+               />
+
+
+           <TextView
+               android:id="@+id/sign_graph_curve_text2_top"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:text="餐后2小时"
+               android:layout_centerVertical="true"
+               android:textSize="@dimen/font_size_12"
+               android:textColor="@color/text_black"
+               android:textStyle="bold"
+               android:visibility="gone"
+               />
+
+           <View
+               android:id="@+id/sign_graph_curve_view_2_top"
+               android:layout_width="@dimen/d25"
+               android:layout_height="@dimen/d2"
+               android:background="@color/button_color"
+               android:layout_alignParentRight="true"
+               android:layout_marginLeft="@dimen/d10"
+               android:layout_centerVertical="true"
+               android:visibility="gone"
+               />
+       </LinearLayout>
+
+
+    </RelativeLayout>
+
+    <TextView
+        android:id="@+id/sign_graph_d"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="单位:mm/L"
+        android:layout_centerVertical="true"
+        android:layout_toLeftOf="@+id/sign_graph_curve_view_2_top"
+        android:textSize="@dimen/font_size_12"
+        android:layout_marginTop="@dimen/d10"
+        android:textColor="@color/text_black"
+        android:textStyle="bold"
+        />
+
+    <ImageView
+        android:id="@+id/sign_graph_emptyImageView"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:src="@mipmap/list"
+        android:layout_gravity="center"
+        android:visibility="gone"
+        />
+    <com.github.mikephil.charting.charts.LineChart
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:id="@+id/chart"/>
+</LinearLayout>
+
+</layout>

+ 23 - 0
android_host/src/main/res/layout/sign_main_item_lay.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:gravity="center_vertical"
+    android:layout_marginLeft="@dimen/d25"
+    >
+    <TextView
+        android:id="@+id/sign_main_item_name"
+        android:layout_width="@dimen/d50"
+        android:layout_height="@dimen/d25"
+        android:text="血糖"
+        android:background="@drawable/shape_main_hos_txt_bg"
+        android:textSize="14sp"
+        android:gravity="center"
+        android:layout_gravity="center_vertical"
+        android:textColor="@color/white"/>
+</LinearLayout>
+    
+</layout>

+ 61 - 0
android_host/src/main/res/layout/sign_view_item_lay.xml

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    >
+
+
+    <LinearLayout
+        android:id="@+id/sign_view_ll_top"
+        android:layout_width="match_parent"
+        android:layout_height="20dp"
+        android:background="@color/white"
+        android:gravity="center_vertical">
+
+        <TextView
+            android:id="@+id/sign_item_name"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:text="01"
+            android:textSize="12sp"
+            android:layout_marginLeft="@dimen/d20"
+            android:gravity="center_vertical"
+            android:textColor="@color/black"/>
+        <TextView
+            android:id="@+id/sign_item_type"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:text="112"
+            android:textSize="12sp"
+            android:gravity="center"
+            android:textColor="@color/black"/>
+        <TextView
+            android:id="@+id/sign_item_money"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:text="256"
+            android:textSize="12sp"
+            android:gravity="center"
+            android:textColor="@color/black"/>
+        <TextView
+            android:id="@+id/sign_item_time"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:text="202-04-06 11:00"
+            android:textSize="12sp"
+            android:gravity="center"
+            android:textColor="@color/black"/>
+
+    </LinearLayout>
+
+    
+</LinearLayout>
+    
+</layout>

BIN
android_host/src/main/res/mipmap-mdpi/img_x.png


+ 1 - 1
bedlib/src/main/java/serialporttest/utils/SerialPortUtil.java

@@ -268,7 +268,7 @@ public class SerialPortUtil {
     }
 
     public void sendData(String data) {
-        //Log.d("bbbb", "data==" + data);
+        Log.d("bbbb", "data==" + data);
         if (!StringUtils.notEmpty(data)) return;
         if (isOpenSerialPortUtil) {
             //reset data

+ 38 - 0
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivationActivity.kt

@@ -280,6 +280,7 @@ class CallingdoorActivationActivity  : BaseActivity<CallingdoorActivationPresent
         } else {
             Log.d(TAG, "server info null")
             showMsgMain("get server null")
+            checkNet()
         }
     }
 
@@ -288,6 +289,43 @@ class CallingdoorActivationActivity  : BaseActivity<CallingdoorActivationPresent
             showMessage(msg)
         }
     }
+    //网络异常计数
+    private var netErrCount : Int = 0
+    private fun checkNet() {
+        /*
+        * 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
+        * 仅对3128设备有效
+         */
+        if (Build.MODEL.equals("rk3128") || BuildConfig.flag == Constant.DEV_W_A133) {
+            Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP))
+            var count = SettingConfig.getNetErrResetCount(this)
+            if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
+                netErrCount++
+            } else {
+                netErrCount = 0
+                if (count > 0) {
+                    count = 0
+                    SettingConfig.setNetErrResetCount(this, count)
+                }
+            }
+
+            if (netErrCount >= 5) {
+                //如果重启次数超过8次还是无网则不再重启
+                if (count < 8) {
+                    count++
+                    SettingConfig.setNetErrResetCount(this, count)
+                    handler.postDelayed({
+                        Log.e("reboot", "重启")
+                        AppUpdateHelper.reboot(this)
+                    }, 5000)
+                } else {
+                    runOnUiThread {
+                        WarningDialogHelper.showDialog(this)
+                    }
+                }
+            }
+        }
+    }
     override fun attachBaseContext(base: Context) {
         val languageId: Int = SettingConfig.getLanguageId(base)
         LocaleMangerUtils.setApplicationLanguageByIndex(base, languageId)

+ 41 - 27
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/activity/CallingdoorActivity.kt

@@ -1316,6 +1316,10 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
                             presenter.loadPartSettings(Constant.PART_ID)
                         } else if (tcpModel.action == TcpAction.DeviceAction.RESTART) {
                             //initDevice()
+                            //后台做了重发此消息的机制.防止网络不好的时候没收到app重启,设备信息不刷新
+                            if(!TextUtils.isEmpty(tcpModel.tid)) {
+                                TcpClient.getInstance().sendMsg(tcpModel.toJson())
+                            }
                             //收到重启app指令,若当前处于正常待机状态则直接重启app,否则等待通话结束再重启
                             if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
                                 AppUpdateHelper.restartApp(activity)
@@ -1574,34 +1578,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
             view_title_layout_iv_bt.visibility = View.GONE
         }
 
-        /*
-        * 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
-         */
-        if ("rk3128".equals(Build.MODEL)) {
-            var count = SettingConfig.getNetErrResetCount(this)
-            if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
-                netErrCount++
-            } else {
-                netErrCount = 0
-                if (count > 0) {
-                    count = 0
-                    SettingConfig.setNetErrResetCount(this, count)
-                }
-            }
 
-            if (netErrCount >= 5) {
-                //如果重启次数超过8次还是无网则不再重启
-                if (count < 8) {
-                    count++
-                    SettingConfig.setNetErrResetCount(this, count)
-                    Handler().postDelayed({
-                        AppUpdateHelper.reboot(this)
-                    }, 5000)
-                } else {
-                    WarningDialogHelper.showDialog(this@CallingdoorActivity)
-                }
-            }
-        }
     }
 
     private fun updateTcpState() {
@@ -1694,9 +1671,46 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
                     //还未连接tcp服务器
 //                    presenter.loadTcpServerHost()
                 }
+                checkNet()
             } else if (intent.action == ConnectivityManager.CONNECTIVITY_ACTION) {
                 updateNetState()
             }
         }
     }
+
+    private fun checkNet() {
+        /*
+        * 检查网络情况,若tcp断开连接多次且IP也是空的则网络异常,重启设备
+        * 仅对3128设备有效
+         */
+        if (Build.MODEL.equals("rk3128") || BuildConfig.flag == Constant.DEV_W_A133) {
+            Log.e("checkNet", "checkNet --> netErrCount: " + netErrCount + ", IP isEmpty: " + TextUtils.isEmpty(NetHelper.getInstance().localIP))
+            var count = SettingConfig.getNetErrResetCount(this)
+            if (!Constant.TCP_CONNECTED && TextUtils.isEmpty(NetHelper.getInstance().localIP)) {
+                netErrCount++
+            } else {
+                netErrCount = 0
+                if (count > 0) {
+                    count = 0
+                    SettingConfig.setNetErrResetCount(this, count)
+                }
+            }
+
+            if (netErrCount >= 5) {
+                //如果重启次数超过8次还是无网则不再重启
+                if (count < 8) {
+                    count++
+                    SettingConfig.setNetErrResetCount(this, count)
+                    handler.postDelayed({
+                        Log.e("reboot", "重启")
+                        AppUpdateHelper.reboot(this)
+                    }, 5000)
+                } else {
+                    runOnUiThread {
+                        WarningDialogHelper.showDialog(this)
+                    }
+                }
+            }
+        }
+    }
 }

+ 30 - 10
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/helper/AppUpdateHelper.java

@@ -13,8 +13,11 @@ import android.os.Environment;
 
 import android.util.Log;
 
+import com.wdkl.app.ncs.callingdoor.BuildConfig;
 import com.wdkl.app.ncs.callingdoor.hardware.HardWareFactroy;
 import com.wdkl.ncs.android.component.welcome.activity.WelcomeActivity;
+import com.wdkl.ncs.android.middleware.common.Constant;
+import com.wdkl.ncs.android.middleware.utils.AppUtil;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -209,18 +212,35 @@ public class AppUpdateHelper {
         }
     }
 
+
     public static void reboot(Context context) {
-        try {
-            Intent intent = new Intent(Intent.ACTION_REBOOT);
-            intent.putExtra("nowait", 1);
-            intent.putExtra("interval", 1);
-            intent.putExtra("window", 0);
-            context.sendBroadcast(intent);
-            HardWareFactroy.getHardTools().resetDevice();
-        } catch (Exception e) {
-            e.printStackTrace();
+        Log.e("reboot","重启");
+        if (Build.MODEL.equals("rk3128")  || BuildConfig.flag.equals(Constant.DEV_W_A133)) {
+            try {
+                SerialPortHelper.resetDevice();
+                Intent intent = new Intent(Intent.ACTION_REBOOT);
+                intent.putExtra("nowait", 1);
+                intent.putExtra("interval", 1);
+                intent.putExtra("window", 0);
+                context.sendBroadcast(intent);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            Process process;
+            PrintWriter printWriter;
+            try {
+                process = Runtime.getRuntime().exec(AppUtil.DEFAULT_SU_PATH);
+                printWriter = new PrintWriter(process.getOutputStream());
+                printWriter.println("reboot");
+                printWriter.flush();
+                printWriter.close();
+                process.waitFor();
+            } catch (Exception e) {
+                e.printStackTrace();
+                restartApp(context);
+            }
         }
-
     }
 
     public static void restartApp(Context context) {

+ 1 - 1
callingdoor/src/main/res/layout/callingdoor_main_new.xml

@@ -338,7 +338,7 @@
                 />
         </RelativeLayout>
 
-        <!--通话界面-->
+        <!--月子中心-->
         <FrameLayout
             android:id="@+id/mom_frame_new"
             android:layout_width="match_parent"

+ 1 - 1
middleware/src/main/code/com/wdkl/ncs/android/middleware/utils/AppUtil.java

@@ -16,7 +16,7 @@ import java.util.Calendar;
 import java.util.List;
 
 public class AppUtil {
-
+    public static final String DEFAULT_SU_PATH = "su";
 
     /**
      * 设置静音