浏览代码

月子版门口机异常处理

weizhengliang 1 年之前
父节点
当前提交
9eee4687d0
共有 1 个文件被更改,包括 96 次插入96 次删除
  1. 96 96
      callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/fragment/MomFragment.kt

+ 96 - 96
callingdoor/src/main/java/com/wdkl/app/ncs/callingdoor/fragment/MomFragment.kt

@@ -123,117 +123,117 @@ class  MomFragment : BaseFragment<MainFragmentPresenter, CallingBabymomMainBindi
                 babyList.clear()
                 bedList.addAll(roomInfo.frameBedList)
 
-                babymom_mian_name.text = bedList.get(0).customerName
-                babymom_mian_age.text = bedList.get(0).customerAge.toString()+bedList.get(0).customerAgeUnit
-                babymom_mian_time_out.text =getString(R.string.door_mom_main_1)+TimeHandle.getDateTime( bedList.get(0).customerInDate  * 1000L, "yyyy年MM月dd日")
-                babymom_mian_time_end.text = getString(R.string.door_mom_main_2)+  TimeHandle.getDateTime( bedList.get(0).customerOutDate  * 1000L, "yyyy年MM月dd日")
+                try {
+                    val bedVO = bedList[0]
+                    babymom_mian_name.text = bedVO.customerName
+                    babymom_mian_age.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
 
-                if (bedList[0].frameBedRelativeVos!=null){
-                    babyList.addAll( bedList[0].frameBedRelativeVos)
-                }
-
-                if (babyList!=null){
-                   val names = StringBuilder()
-                    val sexs = StringBuilder()
-                    var hasSexEqualOne = false // 默认为 false
-                    for (baby in babyList) {
-                        names.append(baby.relativeMemberName).append("\n")
-                        sexs.append(baby.relativeName).append("\n")
-                        if (baby.relativeSex == 1) {
-                            hasSexEqualOne = true
-                        }
+                    if (bedVO.customerInDate != null) {
+                        babymom_mian_time_out.text = getString(R.string.door_mom_main_1) + TimeHandle.getDateTime(bedVO.customerInDate * 1000L, "yyyy年MM月dd日")
                     }
 
-                    if (hasSexEqualOne){
-                        babymom_mian_title_tx3.setBackgroundResource(R.drawable.shape_baby_bg_title4)
-                        babymom_mian_title_tx4.setBackgroundResource(R.drawable.shape_baby_bg_title3)
-                        babymom_mian_title_tx5.setBackgroundResource(R.drawable.shape_baby_bg_title3)
-                    }else{
-                        babymom_mian_title_tx3.setBackgroundResource(R.drawable.shape_baby_bg_title)
-                        babymom_mian_title_tx4.setBackgroundResource(R.drawable.shape_baby_bg_title2)
-                        babymom_mian_title_tx5.setBackgroundResource(R.drawable.shape_baby_bg_title2)
+                    if (bedVO.customerOutDate != null) {
+                        babymom_mian_time_end.text = getString(R.string.door_mom_main_2) + TimeHandle.getDateTime(bedVO.customerOutDate * 1000L, "yyyy年MM月dd日")
                     }
 
-                    // 删除最后一个斜杠
-                    if (names.isNotEmpty()) {
-                        names.deleteCharAt(names.length - 1)
-                    }
-                    if (sexs.isNotEmpty()) {
-                        sexs.deleteCharAt(sexs.length - 1)
+                    if (bedVO.frameBedRelativeVos != null) {
+                        babyList.addAll(bedVO.frameBedRelativeVos)
                     }
 
-                    babymom_mian_baby_name.text =  names.toString()
-                    babymom_mian_baby_sex.text =  sexs.toString()
-                    if (babyList.size ==1 && babyList.get(0).relativeSex == 1){
-                        //背景变为蓝色
-                        calling_door_babymom_mian.setBackgroundResource(R.color.mom_main_color)
-                        babymom_mian_top_txt.setTextColor(resources.getColor(R.color.mom_main_color))
-                        babymom_mian_top.setBackgroundResource(R.drawable.shape_baby_top_bg)
-                        babymom_mian_title_tx.setBackgroundResource(R.drawable.shape_baby_bg_title4)
-                        babymom_mian_title_tx1.setBackgroundResource(R.drawable.shape_baby_bg_title3)
-                        babymom_mian_title_tx2.setBackgroundResource(R.drawable.shape_baby_bg_title3)
-                        baby_img.visibility = View.INVISIBLE
-                        baby_img2.setBackgroundResource(R.mipmap.nan_right)
-                        mom_view_title_layout_tv_hospital_name.setTextColor(resources.getColor(R.color.mom_main_color))
-                        return
-                    }else{
-                        calling_door_babymom_mian.setBackgroundResource(R.color.baby_bg)
-                        babymom_mian_top_txt.setTextColor(resources.getColor(R.color.baby_top_txt))
-                        babymom_mian_top.setBackgroundResource(R.drawable.shape_baby_top_bg2)
-                        babymom_mian_title_tx.setBackgroundResource(R.drawable.shape_baby_bg_title)
-                        babymom_mian_title_tx1.setBackgroundResource(R.drawable.shape_baby_bg_title2)
-                        babymom_mian_title_tx2.setBackgroundResource(R.drawable.shape_baby_bg_title2)
-                        if (babyList.size ==1){
-                            baby_img.visibility = View.INVISIBLE
-                            baby_img2.setBackgroundResource(R.mipmap.nv)
-                            return
+                    if (babyList != null) {
+                        val names = StringBuilder()
+                        val sexs = StringBuilder()
+                        var hasSexEqualOne = false // 默认为 false
+                        for (baby in babyList) {
+                            names.append(baby.relativeMemberName).append("\n")
+                            sexs.append(baby.relativeName).append("\n")
+                            if (baby.relativeSex == 1) {
+                                hasSexEqualOne = true
+                            }
                         }
-                    }
-
-                    val allSexEqualOne = babyList.all { it.relativeSex == 1 }
-                    val allSexEqualTwo = babyList.all { it.relativeSex == 0 }
-                    val hasSexEqualOnes = babyList.any { it.relativeSex == 1 }
-                    val hasSexEqualTwo = babyList.any { it.relativeSex == 0 }
-
-                    if (babyList.size !=1 && allSexEqualOne){
-                        calling_door_babymom_mian.setBackgroundResource(R.color.mom_main_color)
-                        babymom_mian_top_txt.setTextColor(resources.getColor(R.color.mom_main_color))
-                        babymom_mian_top.setBackgroundResource(R.drawable.shape_baby_top_bg)
-                        babymom_mian_title_tx.setBackgroundResource(R.drawable.shape_baby_bg_title4)
-                        babymom_mian_title_tx1.setBackgroundResource(R.drawable.shape_baby_bg_title3)
-                        babymom_mian_title_tx2.setBackgroundResource(R.drawable.shape_baby_bg_title3)
-                        mom_view_title_layout_tv_hospital_name.setTextColor(resources.getColor(R.color.mom_main_color))
-                        baby_img.visibility = View.VISIBLE
-                        baby_img.setBackgroundResource(R.mipmap.nan)
-                        baby_img2.setBackgroundResource(R.mipmap.nan_right)
-                        return
-                    }
-                    if (babyList.size !=1 && allSexEqualTwo){
-                        baby_img.visibility = View.VISIBLE
-                        baby_img.setBackgroundResource(R.mipmap.nv_left)
-                        baby_img2.setBackgroundResource(R.mipmap.nv)
-                        return
-                    }
-                    if (babyList.size !=1 && hasSexEqualOnes){
-                        baby_img.visibility = View.VISIBLE
-                        baby_img.setBackgroundResource(R.mipmap.nv_left)
-                        baby_img2.setBackgroundResource(R.mipmap.nan_right)
-                        return
-                    }
-
-
 
+                        if (hasSexEqualOne) {
+                            babymom_mian_title_tx3.setBackgroundResource(R.drawable.shape_baby_bg_title4)
+                            babymom_mian_title_tx4.setBackgroundResource(R.drawable.shape_baby_bg_title3)
+                            babymom_mian_title_tx5.setBackgroundResource(R.drawable.shape_baby_bg_title3)
+                        } else {
+                            babymom_mian_title_tx3.setBackgroundResource(R.drawable.shape_baby_bg_title)
+                            babymom_mian_title_tx4.setBackgroundResource(R.drawable.shape_baby_bg_title2)
+                            babymom_mian_title_tx5.setBackgroundResource(R.drawable.shape_baby_bg_title2)
+                        }
 
+                        // 删除最后一个斜杠
+                        if (names.isNotEmpty()) {
+                            names.deleteCharAt(names.length - 1)
+                        }
+                        if (sexs.isNotEmpty()) {
+                            sexs.deleteCharAt(sexs.length - 1)
+                        }
 
+                        babymom_mian_baby_name.text = names.toString()
+                        babymom_mian_baby_sex.text = sexs.toString()
+                        if (babyList.size == 1 && babyList.get(0).relativeSex == 1) {
+                            //背景变为蓝色
+                            calling_door_babymom_mian.setBackgroundResource(R.color.mom_main_color)
+                            babymom_mian_top_txt.setTextColor(resources.getColor(R.color.mom_main_color))
+                            babymom_mian_top.setBackgroundResource(R.drawable.shape_baby_top_bg)
+                            babymom_mian_title_tx.setBackgroundResource(R.drawable.shape_baby_bg_title4)
+                            babymom_mian_title_tx1.setBackgroundResource(R.drawable.shape_baby_bg_title3)
+                            babymom_mian_title_tx2.setBackgroundResource(R.drawable.shape_baby_bg_title3)
+                            baby_img.visibility = View.INVISIBLE
+                            baby_img2.setBackgroundResource(R.mipmap.nan_right)
+                            mom_view_title_layout_tv_hospital_name.setTextColor(resources.getColor(R.color.mom_main_color))
+                            return
+                        } else {
+                            calling_door_babymom_mian.setBackgroundResource(R.color.baby_bg)
+                            babymom_mian_top_txt.setTextColor(resources.getColor(R.color.baby_top_txt))
+                            babymom_mian_top.setBackgroundResource(R.drawable.shape_baby_top_bg2)
+                            babymom_mian_title_tx.setBackgroundResource(R.drawable.shape_baby_bg_title)
+                            babymom_mian_title_tx1.setBackgroundResource(R.drawable.shape_baby_bg_title2)
+                            babymom_mian_title_tx2.setBackgroundResource(R.drawable.shape_baby_bg_title2)
+                            if (babyList.size == 1) {
+                                baby_img.visibility = View.INVISIBLE
+                                baby_img2.setBackgroundResource(R.mipmap.nv)
+                                return
+                            }
+                        }
 
+                        val allSexEqualOne = babyList.all { it.relativeSex == 1 }
+                        val allSexEqualTwo = babyList.all { it.relativeSex == 0 }
+                        val hasSexEqualOnes = babyList.any { it.relativeSex == 1 }
+                        val hasSexEqualTwo = babyList.any { it.relativeSex == 0 }
+
+                        if (babyList.size != 1 && allSexEqualOne) {
+                            calling_door_babymom_mian.setBackgroundResource(R.color.mom_main_color)
+                            babymom_mian_top_txt.setTextColor(resources.getColor(R.color.mom_main_color))
+                            babymom_mian_top.setBackgroundResource(R.drawable.shape_baby_top_bg)
+                            babymom_mian_title_tx.setBackgroundResource(R.drawable.shape_baby_bg_title4)
+                            babymom_mian_title_tx1.setBackgroundResource(R.drawable.shape_baby_bg_title3)
+                            babymom_mian_title_tx2.setBackgroundResource(R.drawable.shape_baby_bg_title3)
+                            mom_view_title_layout_tv_hospital_name.setTextColor(resources.getColor(R.color.mom_main_color))
+                            baby_img.visibility = View.VISIBLE
+                            baby_img.setBackgroundResource(R.mipmap.nan)
+                            baby_img2.setBackgroundResource(R.mipmap.nan_right)
+                            return
+                        }
+                        if (babyList.size != 1 && allSexEqualTwo) {
+                            baby_img.visibility = View.VISIBLE
+                            baby_img.setBackgroundResource(R.mipmap.nv_left)
+                            baby_img2.setBackgroundResource(R.mipmap.nv)
+                            return
+                        }
+                        if (babyList.size != 1 && hasSexEqualOnes) {
+                            baby_img.visibility = View.VISIBLE
+                            baby_img.setBackgroundResource(R.mipmap.nv_left)
+                            baby_img2.setBackgroundResource(R.mipmap.nan_right)
+                            return
+                        }
+                    }
+                } catch (e: Exception) {
+                    e.printStackTrace()
                 }
-
             }
         }
-
-
-
-
     }