using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNWD.Pregrant.WebService;
using HNWD.Pregrant.Model;
using System.Text;
using HNWD.Pregrant.DataAccess;
using HNWD.Pregrant.Common;
namespace HNWD.Pregrant.WebService.WDMK_I
{
///
/// 主界面
///
public partial class callingDoor_main : PageBase
{
////////测试可用列表
///deviceId
///791
///797
///804
///811
///////////////////////////////
protected void Page_Load(object sender, EventArgs e)
{
string deviceID = this.GetValueByKey("deviceId");
if (string.IsNullOrEmpty(deviceID))
{
this.ResponseDefaultError();
return;
}
/////////////////////////////////////////
/////////////////////////////////////////
if (!this.InitializeDataAccess())
{
this.ResponseDefaultError(PromptingMessage.Error_Data_Initialized);
return;
}
///找门口机
///
///获取数据区域
///
if(!wd_PartInfoDataAccess.ext.bSuccess || wd_PartInfoDataAccess.ext.messageDataList.Count == 0)
{
this.ResponseDefaultError(PromptingMessage.Error_PartInfo);
return;
}
WD_DeviceInfo wd_DeviceInfo = wd_DeviceInfoDataAccess.ext.messageDataList.Find(f => f.ID == deviceID);
if (wd_DeviceInfo == null)
{
this.ResponseDefaultError(PromptingMessage.Error_DeviceInfo);
return;
}
else
{
wd_PartInfoDataAccess.ext.messageDataList.ForEach(f => f.wardNum = wd_DeviceInfo.deviceRoomNum);
wd_PartInfoDataAccess.ext.messageDataList.ForEach(f => f.roomByname = wd_DeviceInfo.DEVICE_NAME);
}
List listBedDevice = wd_DeviceInfoDataAccess.ext.messageDataList.FindAll(f => f.DEVICE_ROOM_ID == deviceID).OrderBy(f=>f.DEVICE_BED_NUM).ToList() ;
/////////////////////////////////////////////////
////////////////////////////////////////////////
foreach (WD_DeviceInfo wd in listBedDevice)
{
bedInfo bedInfo = new bedInfo();
WD_PatientInfo wd_PatientInfo = wd_PatientInfoDataAccess.ext.messageDataList.Find(f => f.ID == wd.DEVICE_HUMAN_ID);
if(wd_PatientInfo == null)
{
wd_PartInfoDataAccess.ext.messageDataList.ForEach(f => f.bedInfoList.Add(bedInfo));
}
else
{
bedInfo.DoctorID = wd_PatientInfo.PATIENT_DOCTOR_ID;
bedInfo.NurseID = wd_PatientInfo.PATIENT_NURSE_ID;
bedInfo.bedNum = wd.deviceBedNum;
bedInfo.bedName = wd.DEVICE_BED_NAME;
bedInfo.roomNum = wd.DEVICE_ROOM_NUM;
bedInfo.bedStatus = Convert.ToInt32(wd.deviceHumanId) > 0 ? "1" : "0";
bedInfo.HumanID = wd.deviceHumanId;
bedInfo.babyName = wd_PatientInfo.PATIENT_BABYNAME;
bedInfo.name = wd_PatientInfo.PATIENT_NAME;
bedInfo.babySex = wd_PatientInfo.PATIENT_BABYSEX;
bedInfo.avoidCertainFood = wd_PatientInfo.PATIENT_ILLNESS;
List listUrgeInfo = wd_UrgeInfoDataAccess.ext.messageDataList.FindAll(f => f.URGE_PATIENT_ID == wd.DEVICE_HUMAN_ID);
if (listUrgeInfo == null || listUrgeInfo.Count == 0)
{
}
else
{
listUrgeInfo.ForEach(f => bedInfo.carefulMatter.Add(new CarefulMatter(){ item = f.URGE_VALUE }));
}
bedInfo.roomByname = wd.DEVICE_NAME;
WD_StaffInfo wdStaffdoc = wd_StaffInfoDataAccess.ext.messageDataList.Find(f => f.ID == bedInfo.DoctorID);
if (wdStaffdoc == null)
{
bedInfo.doctorName = "";
bedInfo.doctorHeadIcon = "";
}
else
{
bedInfo.doctorName = wdStaffdoc.STAFF_NAME;
bedInfo.doctorHeadIcon = wdStaffdoc.STAFF_PICTURE;
}
WD_StaffInfo wdStaffnur = wd_StaffInfoDataAccess.ext.messageDataList.Find(f => f.ID == bedInfo.NurseID);
if (wdStaffnur == null)
{
bedInfo.nurseName = "";
bedInfo.nurseHeadIcon = "";
}
else
{
bedInfo.nurseName = wdStaffnur.STAFF_NAME;
bedInfo.nurseHeadIcon = wdStaffnur.STAFF_PICTURE;
}
wd_PartInfoDataAccess.ext.messageDataList.ForEach(f => f.bedInfoList.Add(bedInfo));
}
}
///////////////////////////////////////////////
////////////////////////////////////////////////
Response.Write(JsonHelper.SerializeWithSuffix(wd_PartInfoDataAccess.ext.messageDataList[0]));
WD_SysLogInfo wd_SysLogInfo = new WD_SysLogInfo();
wd_SysLogInfo.LOG_TYPE = "3";
wd_SysLogInfo.LOG_SOURCE = "门口机ID号【" + deviceID + "】";
wd_SysLogInfo.LOG_CONTENT = "请求【设备配置】数据!" ;
}
}
}