Browse Source

<未入住时去掉白屏界面,显示床位信息>

weizhengliang 4 năm trước cách đây
mục cha
commit
ca0d8f20c4

+ 18 - 0
app/src/main/java/com/wdkl/callingbed2/entity/InitDataEntity.java

@@ -35,6 +35,8 @@ public class InitDataEntity implements Serializable {
     private String deviceSipIp;
     private String deviceWifiHostName;
     private String CurTime;
+    private String hospital;
+    private String departments;
 
     public String getCurTime() {
         return CurTime == null ? "暂无" : CurTime;
@@ -245,4 +247,20 @@ public class InitDataEntity implements Serializable {
     public String getDeviceWifiHostName() {
         return deviceWifiHostName == null ? "暂无" : deviceWifiHostName;
     }
+
+    public String getHospital() {
+        return hospital;
+    }
+
+    public void setHospital(String hospital) {
+        this.hospital = hospital;
+    }
+
+    public String getDepartments() {
+        return departments;
+    }
+
+    public void setDepartments(String departments) {
+        this.departments = departments;
+    }
 }

+ 51 - 16
app/src/main/java/com/wdkl/callingbed2/ui/CallingBedActivity.java

@@ -25,6 +25,7 @@ import android.support.annotation.Nullable;
 import android.support.design.widget.Snackbar;
 import android.support.v4.content.ContextCompat;
 import android.support.v7.widget.RecyclerView;
+import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.MotionEvent;
 import android.view.View;
@@ -335,6 +336,12 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
     TextView tvAgeGender;
     @Bind(R.id.activity_calling_bed_layout_tv_illness)
     TextView tvIllness;
+    @Bind(R.id.tv_patient_number)
+    TextView tvPatientNo;
+    @Bind(R.id.tv_patient_indate)
+    TextView tvPatientIndate;
+    @Bind(R.id.tv_app_version)
+    TextView tvAppVersion;
 
 
     //医嘱界面
@@ -445,6 +452,9 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
     float moveY;
     long currentMS;
 
+    //床位是否入住
+    private boolean isEmptyInfo = true;
+
     /**
      * 时间线程
      */
@@ -488,9 +498,9 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                         }
 
                         //拉起增长页面(20191017 waderson)
-                        if(MyApplication.have_long_main_page){
-                            callLongNursePage(second);
-                        }
+                        //if(MyApplication.have_long_main_page){
+                        //    callLongNursePage(second);
+                        //}
 
                         //自动回来主页面 add by waderson 20190707
                         comeBackMainPage();
@@ -894,6 +904,8 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
          * 由于机器性能方面的差异有些机子的串口反应速度比较慢;急速初始化将失效!
          * */
         handler.sendEmptyMessageDelayed(INIT_SYSTEM, 3000);
+
+        tvAppVersion.setText("V" + BuildConfig.VERSION_NAME);
     }
 
     /**
@@ -997,6 +1009,10 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
             String str_m = str.substring(0, 6 - initDataEntity.getId().length()) + initDataEntity.getId();
 
             tvExtensionNum.setText("分机号:" + str_m);
+
+            if (!TextUtils.isEmpty(initDataEntity.getHospital()) && !TextUtils.isEmpty(initDataEntity.getDepartments())) {
+                tvHospitalName.setText(initDataEntity.getHospital() + initDataEntity.getDepartments());
+            }
         }
     }
 
@@ -1211,7 +1227,8 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                     });
         } else {
             LogUtil.d("getMainData", "setWelcomeView==succeed==");
-            setWelcomeView();
+            //setWelcomeView();
+            setDefaultMainView();
             dismissNurseBrightness();
         }
     }
@@ -1333,12 +1350,22 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
         vWelcome.setVisibility(View.VISIBLE);
     }
 
+    private void setDefaultMainView() {
+        isEmptyInfo = true;
+        setTitle();
+        vMain.setVisibility(View.VISIBLE);
+        if (initDataEntity != null) {
+            tvBedNum.setText(initDataEntity.getDeviceBedNum());
+        }
+    }
+
     /**
      * 更新主界面UI
      */
     private void setMainView() {
         if (null != mainDataEntity) {
             //关闭欢迎界面
+            isEmptyInfo = false;
             vWelcome.setVisibility(View.GONE);
             vMain.setVisibility(View.VISIBLE);
 
@@ -1384,7 +1411,13 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
             tvAgeGender.setText(ageGender);
 
             //病情
-            tvIllness.setText(mainDataEntity.getIllness());
+            if (TextUtils.isEmpty(mainDataEntity.getIllness())) {
+                tvIllness.setText("暂无");
+            } else {
+                tvIllness.setText(mainDataEntity.getIllness());
+            }
+            tvPatientNo.setText("住院号: " + mainDataEntity.getInpatientNum());
+            tvPatientIndate.setText("入院日期: " + mainDataEntity.getAdmissionTime());
 
             setTitle();
         }
@@ -1553,9 +1586,9 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
             }
         }
 
-        if (null != vWelcome) {
+        if (!isEmptyInfo) {
             //只有在欢迎界面没有显示的时候串口才能用
-            if (vWelcome.getVisibility() == View.GONE) {
+            //if (vWelcome.getVisibility() == View.GONE) {
                 //面板呼叫按键
                 if (buffer[5] == -1) {//按键常态
                     LogUtil.d("WWW", "呼叫护士键==-1");
@@ -1612,7 +1645,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                         }
                     });
                 }
-            }
+            //}
         }
 
     }
@@ -2380,9 +2413,11 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
     protected void showLlRightView() {
         timeOfHideSlideView = 0;
         //changeTextColor(null);
-        Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.in_righttoleft);
-        llRight.setAnimation(animation);
-        llRight.setVisibility(View.VISIBLE);
+        if (!isEmptyInfo) {
+            Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.in_righttoleft);
+            llRight.setAnimation(animation);
+            llRight.setVisibility(View.VISIBLE);
+        }
     }
 
     /**
@@ -2626,9 +2661,9 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
     @Override
     public void onStatusVvsipCallEvent(VvsipCall call) {
         LogUtil.d("QQWW", "onStatusVvsipCallEvent----call.mState:==" + call.mState + call.isIncomingCall());
-        if (!isVisible(vWelcome)) {
-            vMain_big.setVisibility(View.GONE);//显示增长页面20191017
-        }
+//        if (!isVisible(vWelcome)) {
+//            vMain_big.setVisibility(View.GONE);//显示增长页面20191017
+//        }
         switch (call.mState) {
             case 0://正在呼叫中:子机自动接通 isIncomingCall() = true  mState = 0  //正在通话中:isIncomingCall() = true
                 CALL_STATUS = Constants.IN_CALL;
@@ -2774,7 +2809,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
     protected void comeBackMainPage() {
         timeOfBackMainPage++;
         timeOut--;
-        if (!isVisible(vMain) && timeOfBackMainPage >= callTimeOutBack && !CALL_STATUS.equals(Constants.IN_CALLING) && !isVisible(vWelcome)) {
+        if (!isVisible(vMain) && timeOfBackMainPage >= callTimeOutBack && !CALL_STATUS.equals(Constants.IN_CALLING) && !isEmptyInfo) {
 //            if (callNurse) {//超时自动取消呼叫了,20191118 之前是长按取消呼叫,后来又改成了根据UI的改变来取消,说让客户一目了然
 //                callNurse = false;
 //                UdpSendUtil.sendHangUp(initDataEntity, mainDataEntity);//取消呼叫 add by waderson 20191118
@@ -2820,7 +2855,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
      * 自动拉起护理项加长页面
      */
     protected void callLongNursePage(String second) {
-        if (!isVisible(vWelcome) && !CALL_STATUS.equals(Constants.IN_CALLING)) {
+        if (!isEmptyInfo && !CALL_STATUS.equals(Constants.IN_CALLING)) {
 
             if ("0".equals(second) || "30".equals(second)) {//一分钟跳4次
                 if (isVisible(vMain) && !isVisible(vMain_big)) {

+ 2 - 1
app/src/main/res/layout/activity_init_layout.xml

@@ -21,6 +21,7 @@
         android:layout_marginRight="5dp"
         android:layout_marginBottom="5dp"
         android:text="2019-07-01 17:16"
-        android:textSize="14sp" />
+        android:textSize="14sp"
+        android:visibility="gone"/>
 
 </RelativeLayout>

+ 70 - 22
app/src/main/res/layout/view_main_layout2.xml

@@ -248,7 +248,7 @@
         android:layout_width="match_parent"
         android:layout_height="570dp"
         android:layout_toRightOf="@id/activity_calling_bed_layout_ll_middle"
-        android:gravity="center_horizontal"
+        android:gravity="center_horizontal|bottom"
         android:orientation="vertical"
         android:background="@drawable/shape_patient_bg">
         <com.wdkl.callingbed2.util.MarqueeText
@@ -263,7 +263,7 @@
             android:focusableInTouchMode="true"
             android:marqueeRepeatLimit="marquee_forever"
             android:singleLine="true"
-            android:text="张小米"
+            android:text="---"
             android:textColor="#3CA2E0"
             android:textSize="120sp"
             android:textStyle="bold" />
@@ -273,7 +273,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginTop="20dp"
-            android:text="【女  23岁】"
+            android:text="【-  --】"
             android:textColor="#3CA2E0"
             android:textSize="80sp" />
 
@@ -290,16 +290,49 @@
             android:paddingLeft="10dp"
             android:text="病情诊断:"
             android:textColor="#3CA2E0"
-            android:textSize="32sp" />
+            android:textSize="30sp" />
 
-        <TextView
+        <com.wdkl.callingbed2.util.MarqueeText
             android:id="@+id/activity_calling_bed_layout_tv_illness"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="10dp"
-            android:text="------"
+            android:ellipsize="marquee"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            android:marqueeRepeatLimit="marquee_forever"
+            android:singleLine="true"
+            android:text="暂无"
             android:textColor="@color/black"
-            android:textSize="@dimen/font_size_28" />
+            android:textSize="30sp" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:layout_marginTop="10dp"
+            android:layout_marginBottom="10dp">
+            <TextView
+                android:id="@+id/tv_patient_number"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:paddingLeft="10dp"
+                android:text="住院号:---"
+                android:textColor="#3CA2E0"
+                android:textSize="24sp"/>
+            <TextView
+                android:id="@+id/tv_patient_indate"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:gravity="end"
+                android:paddingRight="10dp"
+                android:text="入院日期:----"
+                android:textColor="#3CA2E0"
+                android:textSize="24sp"/>
+        </LinearLayout>
+
     </LinearLayout>
 
     <!--右下侧通知信息-->
@@ -320,22 +353,37 @@
             android:src="@mipmap/message"
             android:scaleType="fitXY"/>
 
-        <com.wdkl.callingbed2.widget.view.MyTextView
-            android:id="@+id/activity_calling_bed_layout_tv_message"
+        <LinearLayout
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:paddingTop="12dp"
-            android:paddingLeft="20dp"
-            android:paddingRight="10dp"
-            android:ellipsize="marquee"
-            android:focusable="true"
-            android:focusableInTouchMode="true"
-            android:marqueeRepeatLimit="marquee_forever"
-            android:scrollHorizontally="true"
-            android:text="当前无公告"
-            android:singleLine="true"
-            android:textColor="@color/black"
-            android:textSize="28sp" />
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:orientation="vertical">
+            <com.wdkl.callingbed2.widget.view.MyTextView
+                android:id="@+id/activity_calling_bed_layout_tv_message"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:ellipsize="marquee"
+                android:focusable="true"
+                android:focusableInTouchMode="true"
+                android:marqueeRepeatLimit="marquee_forever"
+                android:paddingLeft="20dp"
+                android:paddingTop="12dp"
+                android:paddingRight="10dp"
+                android:scrollHorizontally="true"
+                android:singleLine="true"
+                android:text="当前无公告"
+                android:textColor="@color/black"
+                android:textSize="28sp" />
+
+            <TextView
+                android:id="@+id/tv_app_version"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="20dp"
+                android:layout_marginRight="10dp"
+                android:gravity="end"
+                android:textSize="22sp" />
+        </LinearLayout>
     </LinearLayout>
 
 </RelativeLayout>