|
@@ -1,5 +1,6 @@
|
|
|
package com.wdkl.app.ncs.callingdoor.fragment
|
|
|
|
|
|
+import android.text.TextUtils
|
|
|
import androidx.recyclerview.widget.GridLayoutManager
|
|
|
import com.enation.javashop.net.engine.model.NetState
|
|
|
import com.google.gson.JsonObject
|
|
@@ -9,6 +10,7 @@ import com.wdkl.app.ncs.callingdoor.adapter.BabyItemAdapter
|
|
|
import com.wdkl.app.ncs.callingdoor.databinding.MainViewLayoutBinding
|
|
|
import com.wdkl.app.ncs.callingdoor.helper.AppInfoDialogHelper
|
|
|
import com.wdkl.app.ncs.callingdoor.helper.AppUpdateHelper
|
|
|
+import com.wdkl.app.ncs.callingdoor.helper.CallTypeDialogHelper
|
|
|
import com.wdkl.app.ncs.callingdoor.launch.CallingdoorLaunch
|
|
|
import com.wdkl.ncs.android.lib.base.BaseApplication
|
|
|
import com.wdkl.ncs.android.lib.base.BaseFragment
|
|
@@ -21,6 +23,7 @@ import com.wdkl.ncs.android.middleware.common.MessageEvent
|
|
|
import com.wdkl.ncs.android.middleware.logic.contract.callingdoor.MainFragmentContract
|
|
|
import com.wdkl.ncs.android.middleware.logic.presenter.callingdoor.MainFragmentPresenter
|
|
|
import com.wdkl.ncs.android.middleware.model.vo.FrameBedRelativeVO
|
|
|
+import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO
|
|
|
import com.wdkl.ncs.android.middleware.model.vo.FrameRoomVO
|
|
|
import com.wdkl.ncs.android.middleware.utils.AppUtil
|
|
|
import com.wdkl.ncs.android.middleware.utils.CommonUtils
|
|
@@ -35,6 +38,7 @@ class YzMainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>
|
|
|
private lateinit var gridLayoutManager: OnegoGridLayoutManager
|
|
|
private lateinit var babyAdapter: BabyItemAdapter
|
|
|
private var babyItems = ArrayList<FrameBedRelativeVO>()
|
|
|
+ private var bedVO: FrameBedVO? = null
|
|
|
|
|
|
override fun getLayId(): Int {
|
|
|
return R.layout.yz_main_view_layout
|
|
@@ -68,6 +72,28 @@ class YzMainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>
|
|
|
|
|
|
return@setOnLongClickListener true
|
|
|
}
|
|
|
+
|
|
|
+ btn_call.setOnClickListener {
|
|
|
+ CallTypeDialogHelper.showDialog(activity, object : CallTypeDialogHelper.ClickListener {
|
|
|
+ override fun onCallNurse() {
|
|
|
+ //呼叫主机
|
|
|
+ if (!TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
|
+ (activity as CallingdoorActivity).startCall(Constant.VOICE_CALL)
|
|
|
+ } else {
|
|
|
+ showMessage(R.string.no_custom)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onCallBed() {
|
|
|
+ //呼叫床位
|
|
|
+ if (bedVO != null && bedVO!!.bedDeviceId != null) {
|
|
|
+ (activity as CallingdoorActivity).startCallBed(Constant.VOICE_CALL, bedVO!!.bedDeviceId)
|
|
|
+ } else {
|
|
|
+ showMessage("找不到设备!")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun destory() {
|
|
@@ -75,49 +101,12 @@ class YzMainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>
|
|
|
|
|
|
override fun showRoomInfo(roomInfo: FrameRoomVO) {
|
|
|
if (roomInfo.frameBedList != null && roomInfo.frameBedList.size > 0) {
|
|
|
- val bedVO = roomInfo.frameBedList[0]
|
|
|
- //加载责护
|
|
|
- if (bedVO.customerId != null) {
|
|
|
- presenter.loadClerk(bedVO.customerId)
|
|
|
- }
|
|
|
+ bedVO = roomInfo.frameBedList[0]
|
|
|
|
|
|
- if (bedVO.frameBedRelativeVos != null && bedVO.frameBedRelativeVos.size > 0) {
|
|
|
- if (bedVO.frameBedRelativeVos.size > 1) {
|
|
|
- //多胞胎
|
|
|
- Constant.babyGirl = true
|
|
|
- //红色主题
|
|
|
- rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
- yz_main_view.setBackgroundResource(R.mipmap.main_bg_girls)
|
|
|
- tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
- tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
- img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
- tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
-
|
|
|
- /*var babyBoy = 0
|
|
|
- for (relative in bedVO.frameBedRelativeVos) {
|
|
|
- if (relative.relativeSex != null && relative.relativeSex == 1) {
|
|
|
- //男孩
|
|
|
- babyBoy++
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //多胞胎
|
|
|
- if (babyBoy == bedVO.frameBedRelativeVos.size) {
|
|
|
- //都是男孩
|
|
|
- Constant.babyGirl = false
|
|
|
- //蓝色主题
|
|
|
- rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_blue)
|
|
|
- yz_main_view.setBackgroundResource(R.mipmap.main_bg_boys)
|
|
|
- tv_in_date.setTextColor(Constant.colorBoy)
|
|
|
- tv_out_date.setTextColor(Constant.colorBoy)
|
|
|
- tv_mother_name.setTextColor(Constant.colorBoy)
|
|
|
- tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_blue)
|
|
|
- img_nurse_icon.setImageResource(R.mipmap.ic_nurse_1)
|
|
|
- tv_nurse_name.setTextColor(Constant.colorBoy)
|
|
|
- } else if (babyBoy == 0) {
|
|
|
- //都是女孩
|
|
|
+ try {
|
|
|
+ if (bedVO!!.frameBedRelativeVos != null && bedVO!!.frameBedRelativeVos.size > 0) {
|
|
|
+ if (bedVO!!.frameBedRelativeVos.size > 1) {
|
|
|
+ //多胞胎
|
|
|
Constant.babyGirl = true
|
|
|
//红色主题
|
|
|
rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
@@ -128,91 +117,143 @@ class YzMainFragment: BaseFragment<MainFragmentPresenter, MainViewLayoutBinding>
|
|
|
tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
+
|
|
|
+ /*var babyBoy = 0
|
|
|
+ for (relative in bedVO.frameBedRelativeVos) {
|
|
|
+ if (relative.relativeSex != null && relative.relativeSex == 1) {
|
|
|
+ //男孩
|
|
|
+ babyBoy++
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //多胞胎
|
|
|
+ if (babyBoy == bedVO.frameBedRelativeVos.size) {
|
|
|
+ //都是男孩
|
|
|
+ Constant.babyGirl = false
|
|
|
+ //蓝色主题
|
|
|
+ rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_blue)
|
|
|
+ yz_main_view.setBackgroundResource(R.mipmap.main_bg_boys)
|
|
|
+ tv_in_date.setTextColor(Constant.colorBoy)
|
|
|
+ tv_out_date.setTextColor(Constant.colorBoy)
|
|
|
+ tv_mother_name.setTextColor(Constant.colorBoy)
|
|
|
+ tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_blue)
|
|
|
+ img_nurse_icon.setImageResource(R.mipmap.ic_nurse_1)
|
|
|
+ tv_nurse_name.setTextColor(Constant.colorBoy)
|
|
|
+ } else if (babyBoy == 0) {
|
|
|
+ //都是女孩
|
|
|
+ Constant.babyGirl = true
|
|
|
+ //红色主题
|
|
|
+ rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
+ yz_main_view.setBackgroundResource(R.mipmap.main_bg_girls)
|
|
|
+ tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
+ tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
+ img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
+ tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
+ } else {
|
|
|
+ //男孩女孩都有
|
|
|
+ Constant.babyGirl = true
|
|
|
+ //红色主题
|
|
|
+ rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
+ yz_main_view.setBackgroundResource(R.mipmap.main_bg_boy_girl)
|
|
|
+ tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
+ tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
+ img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
+ tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
+ }*/
|
|
|
} else {
|
|
|
- //男孩女孩都有
|
|
|
- Constant.babyGirl = true
|
|
|
- //红色主题
|
|
|
- rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
- yz_main_view.setBackgroundResource(R.mipmap.main_bg_boy_girl)
|
|
|
- tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
- tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
- img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
- tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
- }*/
|
|
|
- } else {
|
|
|
- //单胎
|
|
|
- if (bedVO.frameBedRelativeVos[0].relativeSex != null && bedVO.frameBedRelativeVos[0].relativeSex == 1) {
|
|
|
- //男孩
|
|
|
- Constant.babyGirl = false
|
|
|
- //蓝色主题
|
|
|
- rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_blue)
|
|
|
- yz_main_view.setBackgroundResource(R.mipmap.main_bg_boy)
|
|
|
- tv_in_date.setTextColor(Constant.colorBoy)
|
|
|
- tv_out_date.setTextColor(Constant.colorBoy)
|
|
|
- tv_mother_name.setTextColor(Constant.colorBoy)
|
|
|
- tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_blue)
|
|
|
- img_nurse_icon.setImageResource(R.mipmap.ic_nurse_1)
|
|
|
- tv_nurse_name.setTextColor(Constant.colorBoy)
|
|
|
- } else {
|
|
|
- //女孩
|
|
|
- Constant.babyGirl = true
|
|
|
- //红色主题
|
|
|
- rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
- yz_main_view.setBackgroundResource(R.mipmap.main_bg_girl)
|
|
|
- tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
- tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
- img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
- tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
+ //单胎
|
|
|
+ if (bedVO!!.frameBedRelativeVos[0].relativeSex != null && bedVO!!.frameBedRelativeVos[0].relativeSex == 1) {
|
|
|
+ //男孩
|
|
|
+ Constant.babyGirl = false
|
|
|
+ //蓝色主题
|
|
|
+ rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_blue)
|
|
|
+ yz_main_view.setBackgroundResource(R.mipmap.main_bg_boy)
|
|
|
+ tv_in_date.setTextColor(Constant.colorBoy)
|
|
|
+ tv_out_date.setTextColor(Constant.colorBoy)
|
|
|
+ tv_mother_name.setTextColor(Constant.colorBoy)
|
|
|
+ tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_blue)
|
|
|
+ img_nurse_icon.setImageResource(R.mipmap.ic_nurse_1)
|
|
|
+ tv_nurse_name.setTextColor(Constant.colorBoy)
|
|
|
+ } else {
|
|
|
+ //女孩
|
|
|
+ Constant.babyGirl = true
|
|
|
+ //红色主题
|
|
|
+ rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
+ yz_main_view.setBackgroundResource(R.mipmap.main_bg_girl)
|
|
|
+ tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
+ tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
+ img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
+ tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ babyItems.clear()
|
|
|
+ babyItems.addAll(bedVO!!.frameBedRelativeVos)
|
|
|
+ babyAdapter.updateData(babyItems)
|
|
|
+ } else {
|
|
|
+ //女孩
|
|
|
+ Constant.babyGirl = true
|
|
|
+ //红色主题
|
|
|
+ rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
+ yz_main_view.setBackgroundResource(R.mipmap.main_bg_girl)
|
|
|
+ tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
+ tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
+ tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
+ img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
+ tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
+
|
|
|
+ babyItems.clear()
|
|
|
+ babyAdapter.updateData(babyItems)
|
|
|
}
|
|
|
|
|
|
- babyItems.clear()
|
|
|
- babyItems.addAll(bedVO.frameBedRelativeVos)
|
|
|
- babyAdapter.updateData(babyItems)
|
|
|
- } else {
|
|
|
- //女孩
|
|
|
- Constant.babyGirl = true
|
|
|
- //红色主题
|
|
|
- rl_date_view.setBackgroundResource(R.drawable.shape_bottom_bg_red)
|
|
|
- yz_main_view.setBackgroundResource(R.mipmap.main_bg_girl)
|
|
|
- tv_in_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_out_date.setTextColor(Constant.colorGirl)
|
|
|
- tv_mother_name.setTextColor(Constant.colorGirl)
|
|
|
- tv_desc.setBackgroundResource(R.drawable.shape_desc_bg_red)
|
|
|
- img_nurse_icon.setImageResource(R.mipmap.ic_nurse_2)
|
|
|
- tv_nurse_name.setTextColor(Constant.colorGirl)
|
|
|
-
|
|
|
- babyItems.clear()
|
|
|
- babyAdapter.updateData(babyItems)
|
|
|
- }
|
|
|
+ if (bedVO!!.customerInDate != null) {
|
|
|
+ val inDate = TimeHandle.getDateTime(bedVO!!.customerInDate * 1000, "yyyy年MM月dd日")
|
|
|
+ tv_in_date.setText("入住时间: " + inDate)
|
|
|
+ } else {
|
|
|
+ tv_in_date.setText("入住时间:")
|
|
|
+ }
|
|
|
|
|
|
- if (bedVO.customerInDate != null) {
|
|
|
- val inDate = TimeHandle.getDateTime(bedVO.customerInDate*1000, "yyyy年MM月dd日")
|
|
|
- tv_in_date.setText("入住时间: " + inDate)
|
|
|
- } else {
|
|
|
- tv_in_date.setText("入住时间:")
|
|
|
- }
|
|
|
+ if (bedVO!!.customerOutDate != null) {
|
|
|
+ val outDate = TimeHandle.getDateTime(bedVO!!.customerOutDate * 1000, "yyyy年MM月dd日")
|
|
|
+ tv_out_date.setText("出所时间: " + outDate)
|
|
|
+ } else {
|
|
|
+ tv_out_date.setText("出所时间:")
|
|
|
+ }
|
|
|
|
|
|
- if (bedVO.customerOutDate != null) {
|
|
|
- val outDate = TimeHandle.getDateTime(bedVO.customerOutDate*1000, "yyyy年MM月dd日")
|
|
|
- tv_out_date.setText("出所时间: " + outDate)
|
|
|
- } else {
|
|
|
- tv_out_date.setText("出所时间:")
|
|
|
- }
|
|
|
+ tv_mother_name.text = bedVO?.customerName
|
|
|
+ tv_desc.text = bedVO?.customerIllnessDesc
|
|
|
|
|
|
- tv_mother_name.text = bedVO.customerName
|
|
|
- tv_desc.text = bedVO.customerIllnessDesc
|
|
|
+ if (Constant.babyGirl) {
|
|
|
+ btn_call.setBackgroundResource(R.mipmap.mom_call2)
|
|
|
+ } else {
|
|
|
+ btn_call.setBackgroundResource(R.mipmap.mom_call1)
|
|
|
+ }
|
|
|
+
|
|
|
+ //加载责护
|
|
|
+ if (bedVO!!.customerId != null) {
|
|
|
+ presenter.loadClerk(bedVO!!.customerId)
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
|
|
|
EventBus.getDefault().post(MessageEvent("updateTitle", Constant.EVENT_UPDATE_TITLE))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
override fun showClerkInfo(data: JsonObject) {
|
|
|
- tv_nurse_name.text = data.get("clerk_name").asString
|
|
|
+ try {
|
|
|
+ tv_nurse_name.text = data.get("clerk_name").asString
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun onError(message: String, type: Int) {
|